Reading-Notes

View the Project on GitHub MohammadAl-khatib/Reading-Notes

Django REST Framework & Docker

Docker is a software used to share working environment.

Images and Containers

mages and containers are the two fundamental concepts to grasp when you start with Docker. An image is a snapshot in time of what a project contains. A container is a running instance of the image.

A baking analogy we can use here is as follows:

  1. A Dockerfile is the recipe for a cake
  2. An image is a snapshot of the recipe at a given time
  3. A docker-compose.yml says how to make the cake
  4. And the container is the actual, baked cake

Conclusion

That last example with Django probably felt a bit too fast to fully understand. And that’s ok. I wanted to show a working example without getting too bogged down in the complexity of images and containers.

The important takeaways from this tutorial are this:

  1. Docker is a way to run Linux containers
  2. Containers are a lightweight alternative to Virtual Machines
  3. Dockerfile is a list of instructions for creating an image
  4. Images are made up of one or more layers
  5. Containers are a running instance of an image
  6. docker-compose.yml controls how to run the container
  7. Containers are stateless and ephemeral in nature. We can link the local filesystem via volumes but things become more.
  8. complex with databases (which we didn’t cover here).