Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> What Is The Difference Between A Dockerfile, An Image And A Container?

I would like to know what the difference is between a stopped container and an image.



If you're familiar with OOP/language with classes, a fitting analogy could be that a container is an instance of a image, just like you can create instances of classes. The image is the "template" so to say, and the container is the executing of that "template".

So a stopped container could have stuff in it that doesn't exist in the image, as the container has gone through the states of "created > running > stopped" and during the running, you can mutate stuff in the container.

On the other hand, an image never actually runs, only containers created from that image.

I guess you could compare it to VMs as well, where you can have templates/other instances, and clone new instances from that template/other instance. Kind of the same too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: