Sub topic 9
Checking the Compose and Buildx plugins
This chapter assumes you have a working Docker installation, either Docker Desktop or Docker Engine installed from the apt repository. It also assumes you can run docker version without errors. If you can't, finish the verification chapter first.
What the plugins are
Docker's CLI can load extra commands from separate programs called CLI plugins. Two of them matter right after installation:
- Compose adds
docker compose. It runs multi-container applications described in a YAML file. - Buildx adds
docker buildx. It is the front end for BuildKit, the modern image builder. It supports multi-platform images and build caching.
Docker Desktop bundles both. On Ubuntu, the apt command from the install chapter pulls them in as the docker-compose-plugin and docker-buildx-plugin packages. If you installed only docker-ce and docker-ce-cli, neither plugin is present.
Check that each plugin is installed
Run both version commands:
docker compose version
docker buildx versionTypical output looks like this. Your version numbers will differ.
Docker Compose version v2.29.7
github.com/docker/buildx v0.17.1 4a8d1a9Note the spelling. The plugin is docker compose with a space. The older standalone program was docker-compose with a hyphen, written in Python and now retired. Many old tutorials still use the hyphenated form.
List every installed plugin
docker info shows which plugins the CLI has loaded:
docker info --format '{{range .ClientInfo.Plugins}}{{.Name}} {{.Version}}{{"\n"}}{{end}}'You should see at least buildx and compose in the list. This command reads only client-side data, so it is a good way to separate plugin problems from daemon problems.
Run a minimal Compose test
A version number proves the binary exists. A short run proves it works end to end. Create a file named compose.yaml:
services:
hello:
image: hello-worldThen run it:
docker compose up
docker compose downThe output should include the hello-world message, followed by the container exiting with code 0. docker compose down removes the stopped container and the default network.
Run a minimal Buildx test
Check which builders exist:
docker buildx lsYou should see a builder named default, marked with an asterisk. Now build a tiny image. Create a Dockerfile:
FROM alpine:3.20
CMD ["echo", "buildx works"]Build and run it:
docker buildx build --load -t buildx-check .
docker run --rm buildx-checkThe --load flag copies the result into the local image store so docker run can find it. Without it, some builder drivers keep the result only in the build cache.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| `docker: 'compose' is not a docker command` | Plugin package missing | `sudo apt-get install docker-compose-plugin` |
| `docker-compose: command not found` | You typed the old hyphenated name | Use `docker compose` |
| `unknown command: docker buildx` | Buildx package missing | `sudo apt-get install docker-buildx-plugin` |
| `permission denied` on the daemon socket | User not in the `docker` group | Repeat the post-install steps |
| `no configuration file provided` | No `compose.yaml` in the current directory | Change directory, or pass `-f` |
Where plugins live
The CLI searches a few directories for executables whose names start with docker-. On Linux, the apt packages put them in /usr/libexec/docker/cli-plugins. A per-user install goes in ~/.docker/cli-plugins. To see what is present:
ls /usr/libexec/docker/cli-pluginsYou should see docker-buildx and docker-compose. If a file exists but lacks execute permission, the CLI skips it silently, so check the mode bits when a plugin you installed manually does not appear.
Exercise
You run docker compose version and get "'compose' is not a docker command". docker version works fine. Which package is missing on Ubuntu, and which command shows whether the CLI has loaded the plugin after you fix it?
Show answer
The docker-compose-plugin package is missing. Install it with sudo apt-get install docker-compose-plugin, then run docker compose version or the docker info command with the ClientInfo.Plugins format to confirm that compose appears in the plugin list.
Exercise
Why does docker buildx build -t demo . sometimes leave no image visible in docker images, and what flag fixes it?
Show answer
Some builder drivers store the build result only in the build cache instead of the local image store. Adding --load copies the finished image into the local store so docker images and docker run can use it.