HiveBrain v1.2.0
Get Started
← Back to all entries
principledockerMinor

Docker Images via Container vs Dockerfile

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
containerdockerdockerfileviaimages

Problem

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?

Solution

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.

Context

StackExchange DevOps Q#2110, answer score: 7

Revisions (0)

No revisions yet.