当前位置:网站首页>Official image acceleration

Official image acceleration

2022-06-26 05:11:00 Meng Chu

Image download 、 Domain name resolution 、 Time synchronization please click Alibaba open source mirror site

Use Docker You need to download an official image first , for example mysqlwordpress. However, due to network reasons , Download a Docker The official image may take a long time , Even the download failed . So , Alibaba cloud container image service ACR Provides an official mirror site , So as to speed up the download of official images .

Image accelerator is a service for individual developers , Only support individual development scenarios , Re encapsulation or commercial use is not allowed .

explain :  At present due to Docker Hub Limit , As a result, the latest official image cannot be obtained after using the image accelerator . Please remove the accelerator configuration for the time being , Direct connection Docker Hub obtain .

Use the image Accelerator

Under different operating systems , The accelerator is configured in a slightly different way , The following will introduce the configuration methods of the main operating systems .

About the address of the accelerator , You are logged in Container image service console after , Select the mirror tool... In the left navigation bar <abbr style="padding: 0px; margin: 0px; box-sizing: border-box; border: 0px; font-variant: normal;"> > </abbr> Image accelerator , The image accelerator page will display the accelerator address assigned to you independently .

 for example : Accelerator address :[ System assigned prefix ].mirror.aliyuncs.com    

When your Docker When the version is newer

When you download the installed Docker Version No less than 1.10 when , It is suggested to go straight through daemon config To configure . Use profile /etc/docker/daemon.json( Create a new file when there is no ).

{    "registry-mirrors": ["<your accelerate address>"]}            

After the restart Docker Daemon that will do .

When your Docker Older version

You need to modify the corresponding configuration file according to different operating systems .

  • Ubuntu 12.04 - 14.04

    Ubuntu The location of the configuration file is /etc/default/docker Under the table of contents . You only need to add the configuration item of the accelerator in this configuration file , restart Docker that will do .

    echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=<your accelerate address>\"" | sudo tee -a /etc/default/dockersudo service docker restart            
  • Ubuntu 15.04 - 15.10

    Ubuntu The location of the configuration file is /etc/systemd/system/docker.service.d/ Under the table of contents . Create any... In this directory *.conf File can be used as a configuration file . Then add the configuration item of accelerator in this configuration file , After the restart Docker that will do .

    sudo mkdir -p /etc/systemd/system/docker.service.dsudo tee /etc/systemd/system/docker.service.d/mirror.conf <<-'EOF'[Service]ExecStart=ExecStart=/usr/bin/docker daemon -H fd:// --registry-mirror=<your accelerate address>EOFsudo systemctl daemon-reloadsudo systemctl restart docker            
  • CentOS 7

    CentOS The configuration of is a little complicated , You need to set the default configuration file first (/lib/systemd/system/docker.service) Copied to the /etc/systemd/system/docker.service. Then add the accelerator address to the startup command of the configuration file , After the restart Docker that will do .

    sudo cp -n /lib/systemd/system/docker.service /etc/systemd/system/docker.servicesudo sed -i "s|ExecStart=/usr/bin/docker daemon|ExecStart=/usr/bin/docker daemon --registry-mirror=<your accelerate address>|g" /etc/systemd/system/docker.servicesudo sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=<your accelerate address>|g" /etc/systemd/system/docker.servicesudo systemctl daemon-reloadsudo service docker restart            
  • Redhat 7

    Redhat 7 Configuration accelerator , You need to edit /etc/sysconfig/docker The configuration file . stay OPTIONS Add accelerator configuration to the configuration item --registry-mirror=<your accelerate address>. Finally, execute sudo service docker restart Command to restart Docker Daemon.

  • Redhat 6/CentOS 6

    You cannot install directly on these two systems Docker, Need to upgrade the kernel .

    When configuring the accelerator, you need to edit /etc/sysconfig/docker The configuration file . stay other_args Add accelerator configuration to the configuration item --registry-mirror=<your accelerate address>. Finally, execute sudo service docker restart Command to restart Docker Daemon.

  • Docker Toolbox

    stay Windows、Mac System on use Docker Toolbox Words , The recommended practice is to create Linux When it comes to virtual machines , Just configure the address of the accelerator .

    docker-machine create --engine-registry-mirror=<your accelerate address> -d virtualbox defaultdocker-machine env defaulteval "$(docker-machine env default)"docker info            

    If you have passed docker-machine If you create a virtual machine , You need to log in to the virtual machine to modify the configuration .

    1. perform docker-machine ssh <machine-name> Command to log in to the virtual machine .
    2. modify /var/lib/boot2docker/profile file , take --registry-mirror=<your accelerate address> Add to EXTRA_ARGS in .
    3. perform sudo /etc/init.d/docker restart Command to restart Docker service .

When you use Containerd when

When you use Containerd As ACK Runtime , It needs to be modified according to the following contents Containerd Of cri To configure , To make Pod Using the image accelerator . The configuration path is generally /etc/containerd/config.toml.

 [plugins.cri]    ...    [plugins.cri.registry]      [plugins.cri.registry.mirrors]        [plugins.cri.registry.mirrors."docker.io"]          endpoint = ["<your accelerate address>"]

matters needing attention

About the accelerator address in the text <your accelerate address>, Please log in Container image service console , Select the mirror tool... In the left navigation bar <abbr style="padding: 0px; margin: 0px; box-sizing: border-box; border: 0px; font-variant: normal;"> > </abbr> Image accelerator , View in the operation instructions on the image accelerator page , As shown in the figure below . file

原网站

版权声明
本文为[Meng Chu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180507139085.html