DEV Community


Discussion on: Explain Containers Like I’m Five?

theodesp profile image
Theofanis Despoudis

You have lots and lots of toys. A room full of it. Your parents are buying you more every day and as you like surprises. But your younger sister is growing up and also wants piece of the pie. You don't like that. You want to have your own special set of toys that only you can play. So you devise a plan.

First you tell to your mom to get you a box so you can put your toys. Then you ask her to move that box in your room so you can play them there instead of the living room. Then you tell your mom that you are a grown up girl now and don't want to be interrupted. You want privacy and control of how to play with your toys. You also want to set up your own rules on how and when your sister can play with you and share your toys with here.

Containers are like your toys. You are the container runtime and your mom is the host OS that guides you and takes care of the provision of resources. Your sister is another container runtime although you may be sharing this runtime under the rules of your parents. You and your sister are not sharing resources explicitly. She has her own toys and you have yours. When you want to share resource you declare for example that I have those toys to share. This is similar to docker volumes or networks where containers can use them if they are available.

When you ask for more toys, you use your parent to get a toy from the toy registry (akka Docker Registry of similar images) and give it to you. Then you can open the box and start playing (akka creating a container out of the image). Your sister can ask a similar toy or can ask a different toy from the toy registry. Now each toy you have can be customised, for example you have a barbie doll and you can add accessories (add additional layers in the docker container). Your sister also can have her own barbie doll with a different set of accessories.

I hope your 5 year old self understood what containers are.