How to install Docker on Debian 12
- 00:40 cat /etc/os-release
- 00:53 apt update
- 01:07 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- 01:33 echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.li
- 01:46 apt update
- 01:56 apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- 02:57 docker run hello-world
- 03:20 systemctl start docker
- 03:35 systemctl status docker
- 03:52 systemctl enable docker
To Install Docker On Debian 12
Introduction:
Docker is a software platform that lets you create, deploy, and run applications inside containers. Containers are like lightweight, self-contained virtual machines that package up your code and everything it needs to run, making it easy to move and deploy applications across different environments.
Procedure Steps:
Step 1: Check the OS version by using the below command.
root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/
Step 2: Update the package list by using the below command.
root@linuxhelp:~# apt update
Hit:1 http://security.debian.org/debian-security bookworm-security InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
197 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 3: Add docker gpg key by using the below command.
root@linuxhelp:~# curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 4: Add the docker repository by using the below command.
root@linuxhelp:~# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 5: Again update the package list by using the below command.
root@linuxhelp:~# apt update
Get:1 https://download.docker.com/linux/debian bookworm InRelease [43.3 kB]
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Get:4 https://download.docker.com/linux/debian bookworm/stable amd64 Packages [13.5 kB]
Hit:5 http://security.debian.org/debian-security bookworm-security InRelease
Fetched 56.8 kB in 1s (50.7 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
197 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 6: Install docker by using the below command.
root@linuxhelp:~# apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
docker-buildx-plugin docker-ce-rootless-extras git git-man iptables
liberror-perl libip6tc2 libslirp0 pigz slirp4netns
Suggested packages:
aufs-tools cgroupfs-mount | cgroup-lite git-daemon-run | git-daemon-sysvinit
git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
firewalld
The following NEW packages will be installed:
containerd.io docker-buildx-plugin docker-ce docker-ce-cli
docker-ce-rootless-extras docker-compose-plugin git git-man iptables
liberror-perl libip6tc2 libslirp0 pigz slirp4netns
0 upgraded, 14 newly installed, 0 to remove and 197 not upgraded.
Need to get 124 MB of archives.
After this operation, 461 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://download.docker.com/linux/debian bookworm/stable amd64 containerd.io amd64 1.6.26-1 [29.5 MB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 pigz amd64 2.6-1 [64.0 kB]
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptabl
es (iptables) in auto mode
update-alternatives: using /usr/sbin/ip6tables-legacy to provide /usr/sbin/ip6ta
bles (ip6tables) in auto mode
update-alternatives: using /usr/sbin/iptables-nft to provide /usr/sbin/iptables
(iptables) in auto mode
update-alternatives: using /usr/sbin/ip6tables-nft to provide /usr/sbin/ip6table
s (ip6tables) in auto mode
update-alternatives: using /usr/sbin/arptables-nft to provide /usr/sbin/arptable
s (arptables) in auto mode
update-alternatives: using /usr/sbin/ebtables-nft to provide /usr/sbin/ebtables
(ebtables) in auto mode
Setting up docker-ce (5:24.0.7-1~debian.12~bookworm) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /li
b/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/sy
stemd/system/docker.socket.
Setting up git (1:2.39.2-1.1) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u1) ...
Step 7: Verify the installation by using the below command.
root@linuxhelp:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:ac69084025c660510933cca701f615283cdbb3aa0963188770b54c31c8962493
Status: Downloaded newer image for hello-world:latest
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/
Step 8: Start the docker by using the below command.
root@linuxhelp:~# systemctl start docker
Step 9: Check the status of docker by using the below command.
root@linuxhelp:~# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabl>
Active: active (running) since Wed 2023-12-27 05:29:31 IST; 1min 34s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 36859 (dockerd)
Tasks: 10
Memory: 41.3M
CPU: 1.161s
CGroup: /system.slice/docker.service
└─36859 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/con>
Step 10: Enable the docker by using the below command.
root@linuxhelp:~# systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps to install Docker on Debian 12. Your feedback is much welcome.
Comments ( 0 )
No comments available