Ubuntu 系统,Docker 安装步骤 :
1. 更新包索引并安装必要的依赖包:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
2. 添加 Docker 的官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3. 添加 Docker 的软件源:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
4. 更新包索引并安装 Docker CE:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
5. 启动 Docker 并 使能 服务:
sudo systemctl start docker
sudo systemctl enable docker
6. 验证 Docker 是否安装成功:
docker --version
[jn@jn jsoncpp]$ docker --version
Docker version 26.1.2, build 211e74b
[jn@jn jsoncpp]$
7. 运行状态查看
[jn@jn jsoncpp]$ 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 Mon 2024-05-13 23:13:48 +08; 3min 10s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1493343 (dockerd)
Tasks: 16
Memory: 31.0M
CPU: 231ms
CGroup: /system.slice/docker.service
└─1493343 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Mei 13 23:13:47 jn systemd[1]: Starting Docker Application Container Engine...
Mei 13 23:13:47 jn dockerd[1493343]: time="2024-05-13T23:13:47.617402528+08:00" level=info msg="Starting up"
Mei 13 23:13:47 jn dockerd[1493343]: time="2024-05-13T23:13:47.745766561+08:00" level=info msg="Loading containers: start."
Mei 13 23:13:47 jn dockerd[1493343]: time="2024-05-13T23:13:47.984743141+08:00" level=info msg="Loading containers: done."
Mei 13 23:13:48 jn dockerd[1493343]: time="2024-05-13T23:13:48.019822580+08:00" level=info msg="Docker daemon" commit=ef1912d container>
Mei 13 23:13:48 jn dockerd[1493343]: time="2024-05-13T23:13:48.019886045+08:00" level=info msg="Daemon has completed initialization"
Mei 13 23:13:48 jn dockerd[1493343]: time="2024-05-13T23:13:48.036506531+08:00" level=info msg="API listen on /run/docker.sock"
Mei 13 23:13:48 jn systemd[1]: Started Docker Application Container Engine.
lines 1-20/20 (END)