====Docker====
Docker is similar to [[:tools:lxc|LXC]], however it is geared to running a single application within its jailed system rather than being a lightweight VM. It's like having a chroot management system enhanced with networking.
This page details the latest version of docker for Debian bookworm. For older use cases see on docker for Debian [[tools:docker-bullseye|bullseye]].
===Uninstall===
Debian's version of docker is too old so ensure it's not installed.
apt-get remove --purge docker.io docker-compose docker-doc podman-docker containerd runc
Clean up and reboot if an old version was removed.
apt-get autoremove
reboot
===Install===
[[https://docs.docker.com/engine/install/debian/#install-using-the-repository|Install using the apt repository]]
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
===Setup===
[[https://docs.docker.com/engine/install/linux-postinstall/|Linux post-installation steps for Docker Engine]]
sudo groupadd docker
sudo usermod -aG docker $USER
===Reboot===
reboot
===Test===
docker --version
Docker version 27.5.1, build 9f9e405
docker compose version
Docker Compose version v2.32.4
ip addr show docker0
4: docker0: mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ae:18:42:ab brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
===Resources===
[[https://docs.docker.com/get-started/|Docker HOWTO]]
[[https://docs.docker.com/develop/develop-images/dockerfile_best-practices/|Dockerfile Tips]]