Centos7 system installation docker, and configure the accelerator Ali cloud images

Reference docker official website installation documentation and installation documentation Ali cloud

docker's official website installation documentation Address: https://docs.docker.com/install/linux/docker-ce/centos/

Ali cloud docker installation documentation Address: https://yq.aliyun.com/articles/110806?spm=5176.8351553.0.0.66041991AtwfFJ

 

1, uninstall the old version docker (if not installed natural Needless to uninstall it, skip this step)

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

 

2、安装必要的一些系统工具

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

3、添加软件源信息(这里使用国内的阿里云,docker官网上国外地址网速太慢)

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4、更新并安装 Docker-CE(个人版,如果是企业安装也可以选择企业版,参考官网文档:https://docs.docker.com/install/linux/docker-ee/centos/

sudo yum makecache fast
sudo yum -y install docker-ce

5、开启Docker服务

sudo systemctl start docker // centos7 open service is systemctl, centos6 is service

6, check the version docker

Version Docker 

// execute the above command, the results appear below

[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.4
API version: 1.40
Go version: go1.12.10
Git commit: 9013bf583a
Built: Fri Oct 18 15:52:22 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.4
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: 9013bf583a
Built: Fri Oct 18 15:50:54 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683

7, run the test project docker

RUN Hello- Docker the sudo World 
// run the above command, give the following results
[the root @ localhost
~] RUN # Docker the sudo Hello- World Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f Status: Downloaded newer image for hello-world:latest Docker from the Hello ! ////////// phrase that testing appear Mirror ran successfully This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/

Focus on coming! ! ! ! Focus on coming! ! ! ! Focus on coming! ! ! !

8, Ali cloud mirroring configuration accelerator

(1) Open link: https://cr.console.aliyun.com

(2) registered account, or use Alipay account login

(3) After you log in the following page

 

 (4) Select <mirror Accelerator> menu, the right image will show you the unique address of the accelerator, and then select CentOS, copy the code directly on the map the red box can run in the terminal, the following command or copy, modify their mirror after running accelerate address

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": [ "write your own image instead accelerated address" ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

 

Under this centos7 docker system installation has been completed, I hope useful for you! ! !

 

 

 

 

Guess you like

Origin www.cnblogs.com/763977251-sg/p/11837130.html