1. Uninstall the old version of Docker
sudo yum remove docker docker-common docker-selinux docker-engine
2. Execute the following command to install the dependent package
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3. In view of domestic network problems, it is strongly recommended to use domestic sources to execute the following command to add yum software Source
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4. Install Docker CE
sudo yum -y install docker-ce
5. Set up Docker CE to boot
sudo systemctl enable docker sudo systemctl start docker
6. Due to domestic network problems, subsequent pulling of Docker images is very slow and intense. It is recommended to configure domestic image acceleration after installing Docker
sudo vi /etc/docker/daemon.json { "registry-mirrors": ["https://registry.docker-cn.com"] }
7. Restart to take effect
sudo systemctl daemon-reload sudo systemctl restart docker
8.Install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version
The above is the detailed content of Install docker and docker-compose. For more information, please follow other related articles on the PHP Chinese website!