Answers: <p>If one uses a Dockerfile then a colleague could also understand what happened (documentation as code). If one runs a container, enters it, runs commits then it would be hard to understand what packages were installed. Especially after a couple of months.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-09-21T18:43:55.593Z
Answers: Thanks for the reply, the use of versioned Dockerfiles makes sense in that context. One of my concerns is that I frequently work in air-gapped environments, so I figured it would be easier to build a complete image and then export it using `docker pull image:tag
  docker save image:tag -o file.tar` and then `docker load -i file.tar` once it's on their environment. I've run into enormous sizes of containers, and like you stated, it's difficult to keep track exactly what is on it. Dockerfiles would make it easier to build different versions of containers to share on a per instance basis.
Answers: Glenak1911
Answers: CC BY-SA 4.0
Answers: 2017-09-21T16:31:01.657Z
Answers: 2018-11-27T16:06:43.740Z
Answers: 2018-11-27T16:06:43.740Z
Answers: 030
Body: <p>Pardon the dumb questions, but I've been learning about Docker and container technologies and I was learning about using Dockerfiles to specify build instructions for an image, and how each instruction creates a layer that will impact the overall size of the image generated.</p>
  
  <p>I also learned that you can also attach to an image, as a base, and use it as any other server/vm, and commit the container as an image. This is the method I've been using in my few weeks of experimenting with Docker.</p>
  
  <p>Is there any benefit to using one method vs the other? Is reusability enhanced either way? I was also able to push the image I created via container to the registry, is this best practice, or should I be keeping a repository of Dockerfiles?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-10-13T19:53:34.707Z
Comments: Completely unrelatedly, the outfit in your profile picture looks dope.
Comments: Xiong Chiamiov
Comments: CC BY-SA 3.0
Comments: 2017-10-13T20:25:03.650Z
Comments: @XiongChiamiov thanks! Dapper and containerized
Comments: Glenak1911
Tags: <docker><dockerfile><containers>
Title: Docker Images via Container vs Dockerfile
UserDisplayName: Glenak1911
ThreadText: # Docker Images via Container vs Dockerfile
  
  (Asked by: username_0 on 2017-09-21)
  
  Pardon the dumb questions, but I've been learning about Docker and container technologies and I was learning about using Dockerfiles to specify build instructions for an image, and how each instruction creates a layer that will impact the overall size of the image generated.
  
  I also learned that you can also attach to an image, as a base, and use it as any other server/vm, and commit the container as an image. This is the method I've been using in my few weeks of experimenting with Docker.
  
  Is there any benefit to using one method vs the other? Is reusability enhanced either way? I was also able to push the image I created via container to the registry, is this best practice, or should I be keeping a repository of Dockerfiles?
  
  **Tags:** docker, dockerfile, containers
  
  > **Comments:**
  > **username_1**: Completely unrelatedly, the outfit in your profile picture looks dope.  
  > **username_0**: @username_1 thanks! Dapper and containerized  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-09-21. Score: 7 | Accepted answer
  
  If one uses a Dockerfile then a colleague could also understand what happened (documentation as code). If one runs a container, enters it, runs commits then it would be hard to understand what packages were installed. Especially after a couple of months.
  
  > **Comments:**
  > **username_0**: Thanks for the reply, the use of versioned Dockerfiles makes sense in that context. One of my concerns is that I frequently work in air-gapped environments, so I figured it would be easier to build a complete image and then export it using `docker pull image:tag docker save image:tag -o file.tar` and then `docker load -i file.tar` once it's on their environment. I've run into enormous sizes of containers, and like you stated, it's difficult to keep track exactly what is on it. Dockerfiles would make it easier to build different versions of containers to share on a per instance basis.  
  
  ---
  
  