1, Centos7 system installation docker, and Ali cloud images arranged Accelerator

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, 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

Copy the code
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

Copy the code

7, run the test project docker

Copy the code
sudo docker run hello-world
//运行上面命令,得到下面结果
[root@localhost ~]# sudo docker run 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 Hello from Docker! //////////出现这句说明测试镜像运行成功 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/
Copy the code

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

Copy the code
mkdir -p the sudo / etc / Docker 
the sudo TEE /etc/docker/daemon.json << - 'the EOF' 
{ 
  "Registry-Mirrors": [ "write address to accelerate their mirror"] 
} 
the EOF 
the sudo systemctl daemon-reload 
sudo systemctl restart docker
Copy the code

 

Under this centos7 docker system installation has been completed! ! !

Guess you like

Origin www.cnblogs.com/lyh233/p/12563537.html