Best Practices in Docker
As our containers and services grow in size and complexity, it is important to make sure we are keeping true to the best practices when creating our Docker images. This is also true for the applications we run on our Docker images. Later in this chapter, we will look to lint our Dockerfiles
and docker-compose.yml
files, which will analyze our files for errors and best practices, and this will give you a clearer understanding. In the meantime, let's look into some of the more important best practices to keep in mind when you are creating your Docker images and how your applications should be working with them.
Note
This chapter may cover some points from previous chapters, but we will be able to give you more information and clarity on why we are using these practices.
In the following section, we will run through some of the more common best practices you should be following when creating your services and containers.