Docker CLI, since version 19.03 includes the buildx plugin to extend the build functions of Docker based on Buildkit.

Among the main points that Buildkit brings are the following:

  • parallel resolution of dependencies
  • better cache management (import/export, resolution)
  • ability to distribute workloads
  • run without root privileges

And so, as mentioned above, buildkit is now included in docker CLI. Problem, the available and pre-packaged version is not up to date with the latest developments.

If you want to take advantage of the latest evolutions, you will need to update.

buildx version

This tutorial uses buildx version 0.4.1.
Remember to check the latest version number before copying and pasting the instructions.

The steps

Check the existence of the ~/.docker/cli-plugins directory. If it doesn’t exist, create the

mkdir ~/.docker/cli-plugins

Download the latest buildx version from the Buildx release page on Github or directly from your terminal.

wget -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64

Set execution rights on the binary: chmod +x ~/.docker/cli-plugins/docker-buildx.

and voila!

We just have to check if the buildx version is now the expected one.

docker buildx version

If you want buildx to become the default builder of Docker CLI

docker builx install

Demo

asciicast