运行操作系统:
docker01:/etc/apt$ cat /etc/issue
Ubuntu 20.10 \n \l
参考文档:docker官网文档
Install Docker Engine on Ubuntu | Docker Documentation
一、安装docker
安装依赖:
docker01:/etc/apt$ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
添加信任的GPG key
@docker01:~$ curl -fsSL
https://download.docker.com/linux/ubuntu/gpg |sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
添加docker的镜像源
docker01:/etc/apt$ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
docker01:/etc/apt$ sudo apt-get update
安装docker
docker01:/etc/apt$ sudo apt-get install docker-ce docker-ce-cli containerd.io
添加docker服务开机自启动,并启动docker
docker01:/etc/apt$ sudo systemctl enable docker
查看docker 服务状态
docker01:/etc/apt$ 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 Wed 2021-09-08 22:24:13 CST; 4min 53s ago
TriggeredBy: ● docker.socket
Docs:
https://docs.docker.com Main PID: 9398 (dockerd)
Tasks: 8
Memory: 28.8M
CGroup: /system.slice/docker.service
└─9398 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.197566481+08:00" level=warning msg="Your kernel does not support CPU realtime scheduler"
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.197643255+08:00" level=warning msg="Your kernel does not support cgroup blkio weight"
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.197658253+08:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.198185693+08:00" level=info msg="Loading containers: start."
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.436407447+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Dae>
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.531857430+08:00" level=info msg="Loading containers: done."
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.616001469+08:00" level=info msg="Docker daemon" commit=75249d8 graphdriver(s)=overlay2 version=20.10.8
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.616363666+08:00" level=info msg="Daemon has completed initialization"
Sep 08 22:24:13 docker01 systemd[1]: Started Docker Application Container Engine.
Sep 08 22:24:13 docker01 dockerd[9398]: time="2021-09-08T22:24:13.641779103+08:00" level=info msg="API listen on /run/docker.sock"