Details of installing docker and docker compose instances

  • 2021-12-13 07:50:23
  • OfStack

1. Uninstall the old version of Docker


sudo yum remove docker docker-common docker-selinux docker-engine

2. Install the dependency package by executing the following command


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 sources


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 the boot to start Docker CE


sudo systemctl enable docker

sudo systemctl start docker

6. In view of the domestic network problems, it is slow to pull the Docker image for 10 points. It is strongly recommended to configure the domestic image acceleration after installing Docker


sudo vi /etc/docker/daemon.json

{ "registry-mirrors": ["https://registry.docker-cn.com"]

}

7. Restart takes 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

These are the 8 specific steps to install docker and docker-compose. Thank you for your study and support for this site.


Related articles: