CentOS7 Docker Installation Experience

Author: IT Wang Xiaoer blog: itwxe.com

Install Docker

1. Install dependencies.

yum -y install yum-utils device-mapper-persistent-data lvm2
Copy the code

2. Configure aliyun as the repository for Docker installation.

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Copy the code
yum clean all && yum makecache fast
Copy the code

3, install Docker, install the latest version of Docker or install the specified version of Docker, here I use the specified version of installation.

Install the latest version of Docker
yum -y install docker-ce

# version installation specified Docker to check can be installed version USES ` yum list Docker - ce - showduplicates | sort -r ` viewYum -y install docker-ce-18.09.9 docker-ce-cli-18.09.9 containerd. IOCopy the code

4. Domestic access to Docker warehouse is too slow. Configure domestic image acceleration and use Tencent cloud image acceleration.

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://mirror.ccs.tencentyun.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Copy the code

Of course, you can also configure Ali cloud image acceleration, Ali cloud for each user to set exclusive acceleration link, after registering Ali cloud to find the container image service in the console (Ali cloud container image service -> Image accelerator)

5. Start Docker.

If the systemctl restart docker command above is executed, then the docker service is already started.

6, Docker run helloworld test docker can start the container properly.

Two, some commands

# Check the Docker version
docker version
# Docker information
docker info

# start Docker
systemctl start docker
# stop Docker
systemctl stop docker
# restart Docker
systemctl restart docker

# Set Docker to boot with the system
chkconfig docker on
Copy the code

Now that you’ve read this, please like, comment, follow and bookmark it!