$ dpkg -l | grep docker
docker-ce/bionic,now 5:19.03.12~3-0~ubuntu-bionic amd64 [installed] docker-ce-cli/bionic,now 5:19.03.12~3-0~ubuntu-bionic amd64 [installed]
$ dpkg -l | grep containerd
containerd.io/bionic,now 1.2.13-2 amd64 [installed]You might have Docker installed with different package names: docker, docker.io , or docker-engine
$ for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done[Optional] Delete Docker data folder:
$ sudo rm -rf /var/lib/docker[Optional] Delete Docker custom configuration folder:
$ sudo rm -rf /etc/docker/[Optional] Delete docker command configuration folder:
$ rm -rf ~/.docker/
$ sudo apt-get update
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
$ sudo apt-get install ca-certificates curl $ sudo install -m 0755 -d /etc/apt/keyrings $ sudo curl -fsSL https://download.docker.com/linux/ubuntu/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/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$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
$ ps -ef | grep docker
root 12269 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
$ sudo systemctl status docker
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2024-04-29 06:59:47 EDT; 19min ago TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 9987 (dockerd) Tasks: 13 Memory: 21.9M CPU: 418ms CGroup: /system.slice/docker.service └─9987 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
$ sudo systemctl status containerd
● containerd.service - containerd container runtime Loaded: loaded (/lib/systemd/system/containerd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2024-04-29 06:59:46 EDT; 19min ago Docs: https://containerd.io Main PID: 9834 (containerd) Tasks: 12 Memory: 13.7M CPU: 886ms CGroup: /system.slice/containerd.service └─9834 /usr/bin/containerd
$ sudo docker version
Client: Docker Engine - Community Version: 28.1.1 API version: 1.49 Go version: go1.23.8 Git commit: 4eba377 Built: Fri Apr 18 09:52:10 2025 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 28.1.1 API version: 1.49 (minimum version 1.24) Go version: go1.23.8 Git commit: 01f442b Built: Fri Apr 18 09:52:10 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.27 GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da runc: Version: 1.2.5 GitCommit: v1.2.5-0-g59923ef docker-init: Version: 0.19.0 GitCommit: de40ad0Note the versions of the client and the server.
$ sudo docker system info
Client: Docker Engine - Community Version: 28.1.1 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.23.0 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.35.1 Path: /usr/libexec/docker/cli-plugins/docker-compose
Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 28.1.1 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da runc version: v1.2.5-0-g59923ef init version: de40ad0 Security Options: apparmor seccomp Profile: builtin cgroupns ID: 6bf6b3bf-947e-4048-889a-8391e7164a8e Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries: ::1/128 127.0.0.0/8 Live Restore Enabled: falseThe command might show warnings with your Docker installation if any.
$ docker system --help
Usage: docker system COMMAND Manage Docker Commands: df Show docker disk usage events Get real time events from the server info Display system-wide information prune Remove unused datYou can print the Docker disk usage:
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 24 9 2.534GB 1.681GB (66%) Containers 35 18 831.5kB 413.7kB (49%) Local Volumes 0 0 0B 0B Build Cache 10 0 12.29kB 12.29kB
$ sudo docker container run hello-world
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world e6590344b1a5: Pull complete Digest: sha256:c41088499908a59aae84b0a49c70e86f4731e588a737f1637e73c8c09d995654 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 container 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/
$ sudo systemctl enable docker $ sudo systemctl disable docker
$ sudo systemctl start docker $ sudo systemctl stop docker
$ sudo ls -1 /var/lib/docker/
buildkit containers engine-id image network overlay2 plugins runtimes swarm tmp volumes
$ cat /lib/systemd/system/docker.service
[Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target nss-lookup.target docker.socket firewalld.service containerd.service time-set.target Wants=network-online.target containerd.service Requires=docker.socket [Service] Type=notify ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID TimeoutStartSec=0 RestartSec=2 Restart=always
$ cat /lib/systemd/system/docker.socket
[Unit] Description=Docker Socket for the API [Socket] ListenStream=/run/docker.sock SocketMode=0660 SocketUser=root SocketGroup=docker
$ cat /lib/systemd/system/containerd.service
[Unit] Description=containerd container runtime Documentation=https://containerd.io After=network.target local-fs.target dbus.service [Service] ExecStartPre=-/sbin/modprobe overlay ExecStart=/usr/bin/containerd