
Docker Updates You Might Have Missed Docker makes it easy to manage infrastructure the same way that you manage applications. To increase efficiency in how the user performs tasks, Docker is constantly updating its features with the help of its users. Some of the features that have been introduced recently are completely new while others are upgrades of the existing features. This article discusses the new features that you can start using in Docker.
Control image pull
--pull=(always|missing|never)
This new option added to the command run that will help to directly pull the base image. Before this feature was introduced, you had to reuse images that had been locally tagged. For instance, if an image has its base on a moving tag such as ubuntu:bionic, upstream will periodically make changes to it as well as rebuild it. The problem comes when you have an old image that is locally stored because docker without the -pull feature would utilize the old base image instead of the latest one that is built upstream. With the --pull feature, docker is able to directly build against the latest of the base image.
Build an image using a git repo
$ docker build -t foo ssh://USER@github.com/REPO
Docker now allows you to build an image sourced from a git repo that is private using docker build -t foo ssh://USER@github.com/REPO. This will offer flexibility to the developers when they are looking to deploy images stored in a private repo. Before this was deployed, one had to first source the image, locally store it and then build against it.
FUSE-OverlayFS Support
This is a replacement for the OverlayFS whose functionality was limited to only Debian and Ubuntu. The FUSE-OverlayFS support makes it possible to mount OverlayFS without root on any host that has a kernel version 4.18 or above. Where the OverlayFS is not supported, the developer doesn’t have to adjust anything as Docker will automatically shift to FUSE-OverlayFS.
Env files
$ docker exec with -env- file
This will make it possible to store the selected environment variables and when needed, pass them by running docker exec. This will be achieved by running docker exec with the -env- file argument.
Logging Drivers
These drivers will change how developers access the container logs. The logging drivers will allow one to read container logs using docker logs without being limited by logging configurations or plugins. Attempting to collect the container logs automatically is challenging due to the multiple configurations that logging requires.
RMP/DEB Installation Support
The DEBs and RPMs of Docker versions 19.03 or earlier did not come with binaries needed for rootless mode. This meant that the user had to use the Docker installer under $HOME to successfully install the rootless docker. The second alternative was to manually extract the binary files and store them in /user/local/bin.
With Docker 20.10 the DEBs and RPMs now come with rootless binaries. This means that the scripts in Docker Installer are no longer needed although they can still be used if preferred. This feature is enabled by running this script as a non-root user:
$ dockerd-rootless-setuptool.sh install
This script will not install any of the binary files under $HOME, instead, it will install systemd as a unit under $HOME/.config/systemd/user.
Resource Limitations Setup Support
Docker 20.10 now allows the user to set a limit on resources that are allowed for the containers while in rootless mode. In earlier versions, this was not possible because they lacked the cgroup support.
To set up the container resource limits, you’ll need cgroup v2. Note that the cgroup v1 is no longer supported because of security concerns.
Conclusion
Before deploying any of these features, ensure that you understand their impact on your project. Ensure that you also update your Docker to the latest 20.10 version to access all the new features.