Detailed tutorial for installing docker

A brief introduction to Docker

Docker is an open platform for developing, publishing, and running applications. Docker enables you to decouple applications from infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure just like your applications. By leveraging Docker's method of quickly delivering, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production.

  1. Prepare the environment for installation

Linux requires kernel 3.0 or above, and CentOS requires version 7.

Use the uname command to view

2. If Docker has been installed, uninstall the installed Docker first.

yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

3. Install the yum toolkit and storage driver

yum install -y yum-utils

4. Set up the mirror warehouse

yum-config-manager \

    --add-repo \

https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

5.Install docker

Note: docker-ce is the community edition and ee is the enterprise edition. Here we can use the community version.

yum install docker-ce docker-ce-cli containerd.io

 

6. Start docker

systemctl start docker

7. Check the Docker version after installation

docker version

8. Configure Alibaba Cloud image acceleration

Due to domestic network problems, subsequent pulling of Docker images is very slow. We may need to configure an accelerator to solve this problem.

Log in to Alibaba Cloud->Search for "Container Image Service"->Get the accelerator address

 

Use the accelerator by modifying the daemon configuration file /etc/docker/daemon.json

sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'

{

  "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]

}

EOF

# Restart Docker

sudo systemctl daemon-reload

sudo systemctl restart docker

Note: The mirror address of Alibaba Cloud's own account (you need to register one of your own): https://xxxx.mirror.aliyuncs.com

9. Verify whether the configuration is successful

docker info

 

 This tutorial ends here. Thank you pretty boys and pretty girls for watching. I wish all pretty boys and pretty girls watching happy every day.

おすすめ

転載: blog.csdn.net/lyhshs/article/details/130004372