What happens when you put your app in a Docker container
Dockerfile and docker build: how your app becomes an image
Docker can pack an app in one image, with Python and every library the app needs. But Docker cannot guess which version of Python you want. It cannot guess which file starts your app either.
-
1
So you tell Docker, step by step, in a small text file next to your app. You write this list only once, and the file is called a Dockerfile.
-
2
Now one command,
docker build, puts Docker to work. It opens your Dockerfile and follows the steps in order, from top to bottom. -
3
The first step holds a nice surprise: Docker installs nothing. It downloads an image that someone already made with Python inside, and builds yours on top of it. That starting image is called a base image.
-
4
From there, the rest goes fast. Docker adds the dependencies, copies your app in and notes what to start.
-
5
Your image is ready, with everything inside. But it sits on your laptop, and the server, where Miva's requests will go, has never seen it.
-
Quick check
Your laptop is almost out of space.
Show the answer
Yes. Python comes from the base image, and the dependencies are downloaded during the build. From your laptop, Docker takes only your app and the Dockerfile.
-
Go further
Two more words from the build.