1. Download the docker installation package of ubuntu
- Some servers cannot connect to the public network to install docker through the network. You can only download the offline installation package first, and then copy the installation package to an offline machine for manual installation.
1.1 Download path
Download path: https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
1.2 Download version
- To install docker offline, you need to download 3 packages, containerd.io, docker-ce-cli, docker-ce
containerd.io_1.2.6-3_amd64.deb
docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.deb
docker-ce-cli_19.03.9 _3-0_ubuntu-xenial_amd64.deb
Two, install docker
2.1 Upload the docker installation package to the ubuntu server
- After the download is complete, copy it to ubuntu and install it with the dpkg command.
- Installation sequence: first install containerd.io and docker-ce-cli, and finally install docker-ce,
- Command: sudo dpkg -i xxxx.deb
- Perform the installation sequentially, the order cannot be changed
dpkg -i containerd.io_1.2.6-3_amd64.deb
dpkg -i docker-ce-cli_19.03.9_3-0_ubuntu-xenial_amd64.deb
dpkg -i docker-ce_19.03.9_3-0_ubuntu-xenial_amd64.deb
2.2 start docker
systemctl start docker
2.3 View status
systemctl status docker
2.4 View docker information
docker version
2.5 Set docker to start automatically
# 设置 docker自动启动
systemctl enable docker.service
# 查看docker 在系统中状态
systemctl list-unit-files |grep docker
- docker ps View started containers
2.6 Set docker image acceleration source
# 添加加速镜像
cd /etc
mkdir docker
cd /etc/docker
vim daemon.json
# 将下面复制到daemon.json文件中 https://registry.docker-cn.com
{
"registry-mirrors": ["https://81zkznk0.mirror.aliyuncs.com"]
}
# 重启docker
systemctl restart docker.service