They are nothing more than a text file called Dockerfile with the instructions which are required to build a container. Then, each instruction is called a Layer. Following an exemplification.
Example:
FROM ubuntu:18.04 COPY . /app RUN make /app CMD python /app/app.py
See what it is doing:
-
- FROM the ubuntu:18.04 means from where it will start. The ubuntu:18.04 is a Docker image of the Ubuntu SO and 18.04 is its tag/version of it.
- Then, COPY and RUN are instructions to copy all from the current dir to /app and execute the command line
$ make /app.
- Note that the last instruction is the CMD which means that it will be the command executed when the container be initialized to run the application.
NOTES:
Perform the following exercise to learn how to create it.
Also, please feel free to check the tag docker of this website to see all related blog posts.
Sponsored by:
1 Comment