Docker Community Forums

Share and learn in the Docker community.

Is my understanding of how docker works accurate?


(Vrms) #1

this are some newbie questions in order to confirm my understanding of how containers work is accurate. I hope someone might confirm what I think how things work or correct any stupidities

my assumptions:

  1. you have an image and run it inside of a container. The container can only run with the image it was built upon is available, so if you loose the image the container can’t run, correct?

  2. A Container behaves somehow like a layer on top of it’s base image and contains only the changes that have been been made. For example you run a container from a debian image and install Postgresql, postgres only exists in the container (until you might commit the container to a new image). I imagine that similar to cow features of a qcow2 image file for example.

  3. several containers can run simultaneously on top of the same copy on an image. For example you install python2.7 in Container1 (that runs on top of a debian image) and in a Container2 you have python3 running on top of that same debian image at the same time

  4. if you want to build something that needs a Postgresql database you might run 2 containers which talk to each other. ContainerA has your application it can access a Postgresql database which lives in ContainerB. these 2 might be running on top of the same image (as in 3.)

  5. A Container has no predefined size. It just grows with whatever you put inside (just like a normal folder, containing documents)