docker
The Docker engine, CLI, Compose v2, and buildx, with the login user in the docker group.
Installs a complete Docker setup: the engine, the CLI, the Compose v2 plugin, and
buildx. This is the devtool behind “run my docker compose stack on a workstation”.
devtools:
- name: dockerAfter that, docker, docker compose and docker buildx all work for the login user,
without sudo. The version field is not used by this recipe.
What it does
On Debian and Ubuntu it declares Docker’s official apt repository (resolving your
workstation’s distribution and codename automatically), installs docker-ce, docker-ce-cli,
containerd.io, docker-buildx-plugin, and docker-compose-plugin, then enables and
starts the daemon under systemd.
On Alpine it installs the distribution’s docker, docker-cli,
docker-cli-compose, and docker-cli-buildx packages.
Afterwards it adds the workstation’s login user to the docker group, so docker ps
works without sudo. You do not need to list docker under identity.groups.
On a workstation without systemd, the daemon is not started by this recipe; the runtime starts it instead.
When it counts as installed
The workstation only counts as having Docker when all three of these succeed: docker is on
PATH, docker compose version works, and docker buildx version works. A workstation with the
engine but no Compose plugin is not fully configured and the recipe re-runs. That is why
Configured on a workstation that declares this devtool is a real promise that
docker compose up will work.
Example
This config clones a repository that has a docker-compose.yml, installs Docker, brings
the stack up, and forwards the app’s port to your laptop. It applies to every workstation
labeled app: myapp.
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
name: compose-box
namespace: local
spec:
selector:
matchLabels:
app: myapp
identity:
user: dev
packages:
- git
devtools:
- name: docker
sources:
- name: myapp
git:
url: https://github.com/acme/myapp.git
ref: main
path: /home/dev/src/myapp
ports:
- 8080
defaultLocalBinding:
enabled: true
autoForward:
forwardAll: true
scripts:
- name: compose-up
phase: user
content: |
set -e
cd ~/src/myapp
docker compose up --build -dReading it top to bottom:
packagesinstallsgit, whichsourcesneeds to clone.devtoolsinstalls Docker. Devtools install before sources and scripts, sodocker composeexists the first time the script runs.sourcesclones the repository into thedevuser’s home. It clones once; addupdatePolicy: latestto pull new commits on every setup run.portsanddefaultLocalBindingforward port 8080 to your laptop, so the app is athttp://127.0.0.1:8080once the stack is up.scriptsrunsdocker compose uponce, asdev, who is in thedockergroup. To rebuild the stack whenever the code changes, setupdatePolicy: lateston the source and addrunPolicy: onChangeandwatchPaths: [/home/dev/src/myapp]to the script.
If you would rather start the stack yourself, leave out scripts, run
rl shell <workstation>, and type docker compose up in the checkout.
Notes
- Pair with
kindto get a local Kubernetes cluster on top of the engine.kindneeds Docker and should be declared after it. - On Debian and Ubuntu the packages arrive through the normal repository and package
phases, so they interleave correctly with your own
packagesandpackageRepositories.