Creating Docker Images and Dockerfiles
Published byO'Reilly Media, Inc.
Containers have revolutionized the way we engineer and deploy software. No longer do developers need to concern themselves with coding around compatibility issues in the deployment environment because containers carry the complete runtime and binaries within them, rendering them infrastructure agnostic. With container technology, gone are the days when developers would regularly hear the lament, “Well, it worked on my computer…” when trying to determine the cause of a problem in your production application. And from the beginning, Docker has been the leader in this paradigm shifting technology, and Dockerfiles and images have been the foundation upon which the framework stands. Having a solid understanding of how they work is key to building lean, efficient, and reliable applications, particularly for cloud environments.
In this learning path, geared toward developers with prior experience using Docker and a basic understanding of the Dockerfile specification, you’ll gain an understanding of the role of Dockerfiles in the Docker ecosystem. You’ll also look at how the Unionfs filesystem works and how you can use it to build smaller images and reduce the time it takes to build and push images for consumption. You’ll further examine the Dockerfile specification and its vast array of capabilities, including the aspects of it that might trip you up. When you’ve completed this learning path, you will be able to confidently write Dockerfiles and configure containers. And as an added bonus, this learning path provides plenty of suggestions on how to continue your journey in the brand new world of containerization.
What you’ll learn—and how you can apply it
- What the role of the Dockerfile is in the Docker build system
- How the Unionfs works and its effect on building images
- How to create lean, deterministic Docker images
- How to design your Dockerfile to achieve right level of configurability to the resulting container
- How best to use the various instructions in the Dockerfile specification and avoid associated gotchas
- How to use multistage Dockerfiles that allow you to build, test, and package your code all while producing minimal production grade images
This learning path is for you because…
- You're a developer working on writing a Dockerfile for your application and you need to ensure that you are using the docker cache correctly (for faster builds)
- You want to feel confident that you are building the leanest possible image (and consequent container)
- You're a build engineer trying to optimize your build pipeline that uses containers for testing, building, and producing production grade images with absolute minimum fuss
- You're a developer working with a multitier architecture, be that layered, service-based, or microservices, and you need a mechanism to easily spin up your services, databases, and queues that can communicate with one another
Knowledge of Docker.
Materials or downloads needed in advance: TBD