Detailed description of the configuration and use of Docker domestic mirror

  • 2020-06-15 10:51:44
  • OfStack

Docker domestic mirror image

DaoCloud-Docker accelerator Aliyun - Developer platform Micro Mirror - Xiyun cSphere Mirror Square - Speed clouds Spirit finches cloud Netease honeycomb

Docker accelerator for Aliyun

Ali cloud - developer platform: https: / / dev aliyun. com /

Ali cloud - container Hub service console: https: / / cr console. aliyun. com /

After registering and logging into Aliyun - developer platform, click "Create my Container image" on the home page, and you will come to the Service panel of Aliyun. Click on the accelerator TAB.

According to the prompts, enter the password required for Docker login (which can be changed later), and the user name is the user name for aliyun login.

In the event of a page, be able to get an exclusive image of accelerating address, similar to "https: / / 1234 abcd. mirror. aliyuncs. com".

Configure your own Docker accelerator based on the Action Document information on the page.

Alternatively, after logging into the Ali Cloud - container Hub service console, click the accelerator TAB and the corresponding information will appear.

Take CentOS as an example:

CentOS

Install or upgrade Docker

You can download via ali cloud image of warehouse: mirrors. aliyun. com/help/docker - engine


curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

The Docker accelerator is configured

You can use the following script to add the configuration of mirror to the startup parameters of docker daemon.


#  System requirements  CentOS 7  The above, Docker 1.9  The above. 
sudo cp -n /lib/systemd/system/docker.service /etc/systemd/system/docker.service
sudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=https://1234abcd.mirror.aliyuncs.com|g" /etc/systemd/system/docker.service
sudo systemctl daemon-reload
sudo service docker restart

Use of other Docker domestic mirrors

Roughly equivalent to THE Docker accelerator of Aliyun, the main link is the following three steps:

1. Register an account and get the exclusive mirror acceleration address.

2. Upgrade, configure, and restart Docker according to the prompts and system type.

3. Verify whether the configuration is correct through practical operation.

Manually configure the Docker accelerator

The essence of configuring the Docker accelerator is to change the image download address in the Docker configuration file from the default Docker Hub address to the accelerator address of the domestic image.


/lib/systemd/system/docker.service
/etc/systemd/system/docker.service

For example: CentOS7

Add the following to the Docker configuration file /etc/sysconfig/docker , and then restart docker.


OPTIONS=--registry-mirror=http://abcd1234.m.daocloud.io

Related articles: