Docker Slim and Non-Obvious Docker Uses
-
Docker Slim - Earthly Blog
Docker is an open containerization platform for developing, shipping, and running applications. It enables you to package your applications in isolated environments, called containers, where they can run independently from infrastructure. In the container, they have all the dependencies needed for the application to run.
However, a common issue with Docker images is their construction and size. Docker Slim is a tool for optimizing Dockerfiles and Docker images.
It can reduce image size up to thirty times without any manual optimization. It can also help automatically generate security profiles for your Docker containers and has built-in commands that help you analyze and understand your Docker files and images.
-
Non-Obvious Docker Uses
Many developers use Docker the old-fashioned way -- a docker build and a docker run. Some non-obvious ways to use Docker.
As a compiler. I gave a talk at DockerCon back in 2019 about the potential to use Docker as a compiler, and the idea is finally coming to fruition. Use a multi-stage build to copy the output files to a scratch container, then use the --output flag on docker buildx build to output the contents of an image build to a folder. Now you can easily cross-compile binaries (using multiple --platform targets) or whatever else without dealing with actual Docker images.
As a task-runner alternative to make. With Docker Buildkit, you can write alternative frontends to build images (other than the Dockerfile). Together with the built-in caching infrastructure, this makes Docker an interesting replacement for make. That's part of the idea behind the co-founder of Docker's second act, Dagger.