Dockerfile
In this section, we will cover the Dockerfile from a more in-depth perspective than the previous chapter along with the best practices to use. By the end of the section, you will be structuring your Dockerfile in the most practical and efficient method. You will also be able to read and troubleshoot both yours and others' Dockerfile.
A short review of Dockerfile
In the previous chapter, we did a review of the Dockerfile and its content. We looked at something like this:
FROM ubuntu:latest MAINTAINER Scott P. Gallagher <[email protected]> RUN apt-get update && apt-get install -y apache2 ADD 000-default.conf /etc/apache2/sites-available/ RUN chown root:root /etc/apache2/sites-available/000-default.conf EXPOSE 80 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
We saw earlier and in this example as well the basic items that are inside a Dockerfile. The FROM
and MAINTAINER
fields have information on what image is to be used and who is the maintainer of that image. The...