Summary
In this chapter, we discussed how we can use a Dockerfile
to create our own custom Docker images. First, we discussed what is a Dockerfile
and the syntax of a Dockerfile
. We then discussed some common Docker directives, including the FROM
, LABEL
, RUN
, CMD
, and ENTRYPOINT
directives. Then, we created our first Dockerfile
with the common directives that we learned.
In the next section, we focused on building Docker images. We discussed multiple areas in depth regarding Docker images, including the layered filesystem of Docker images, the context in Docker builds, and the use of the cache during the Docker build process. Then, we discussed more advanced Dockerfile
directives, including the ENV
, ARG
, WORKDIR
, COPY
, ADD
, USER
, VOLUME
, EXPOSE
, HEALTHCHECK
, and ONBUILD
directives.
In the next chapter, we will discuss what a Docker registry is, look at private and public Docker registries, and learn how we can publish Docker images to Docker registries.