1. Docker installation and initialization configuration (Linux version)

Docker installation and initial configuration (Linux version)

1. Preparation before installation

1. Switch root user: sudo su
2. Configure network source: vi /etc/apt/sources.list
fill in the following content:

#阿里源地址
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. Update system software source address:apt-get update

2. docker installation

1. Install docker: apt install docker.io
insert image description here
2. Check whether docker is installed successfully: docker -v
3. View docker status:systemctl status docker
insert image description here

3. docker configuration

Follow the steps below to configure image acceleration and set docker to start automatically at boot .
1. Create relevant directories: sudo mkdir -p /etc/docker
2. Create and modify configuration files:

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["http://hub-mirror.c.163.com", "https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn"]
}
EOF
Domestic source address
netease http://hub-mirror.c.163.com
University of Science and Technology of China https://docker.mirrors.ustc.edu.cn
Ali Cloud https://pee6w651.mirror.aliyuncs.com

3. Load the configuration file: sudo systemctl daemon-reload
4. Restart the docker service: sudo systemctl restart docker
5. Set the docker to start automatically:systemctl enable docker
insert image description here

At this point, docker installation and initialization are complete!

Guess you like

Origin blog.csdn.net/weixin_44330367/article/details/129853918