Resources --------- #. |Dockerfile tutorial by example - basics and best practices [2018]| #. |Best practices for writing Dockerfiles| #. |How To Build Your Own Docker Images| #. |Gotchas in Writing Dockerfile| .. |Best practices for writing Dockerfiles| raw:: html Best practices for writing Dockerfiles .. |Dockerfile tutorial by example - basics and best practices [2018]| raw:: html Dockerfile tutorial by example - basics and best practices [2018] .. |Gotchas in Writing Dockerfile| raw:: html Gotchas in Writing Dockerfile .. |How To Build Your Own Docker Images| raw:: html How To Build Your Own Docker Images Dockerfile Elements ------------------- This lab explains how to use ``dockerfile`` to create a docker image. A dockerfile is a text file that contains the commands necessary to create an image using the ``docker build`` command. A ``dockerfile`` uses these commands to build an image. ADD Copy files from a source on the host to the containers own filesystem at the set destination. CMD Execute a specific command within the container. ENTRYPOINT Set a default application to be used every time a container is created with the image. ENV Set environment variables. EXPOSE Expose a specific port to enable networking between the container and the outside world. FROM Define the base image used to start the build process. MAINTAINER Define the full name and email address of the image creator. RUN Central executing directive for Dockerfiles. USER Set the UID (the username) that will run the container. VOLUME Enable access from the container to a directory on the host machine. WORKDIR Set the path where the command, defined with CMD, is to be executed.