How to configure Docker Mirror Accelerator in CoreOS
In this issue, the editor will bring you about how to configure the Docker mirror accelerator in CoreOS. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
The Docker configuration under CoreOS is realized through flannel unit.
The default location of the configuration file can be seen from the command
Systemctl cat docker# / run/systemd/system/ docker.service[Unit] Requires=torcx.targetAfter=torcx.targetDescription=Docker Application Container EngineDocumentation= http://docs.docker.comAfter=containerd.service docker.socket network-online.targetWants=network-online.targetRequires=containerd.service docker.socket[Service] EnvironmentFile=/run/metadata/torcxType=notifyEnvironmentFile=-/run/flannel/flannel_docker_opts.envEnvironment=DOCKER_SELINUX=--selinux-enabled=true/run/flannel/flannel_docker_opts.env
This file is not available by default, so we can create the corresponding directory and file.
Add: if the following error is reported during docker run:
Error response from daemon: error creating overlay mount to / var/lib/docker/overlay2/007018df729636dd7c3d22ea683d13b6f5f0657b7c2c9e0014c671id argument.
You need to modify this item in the / run/systemd/system/docker.service file
Environment=DOCKER_SELINUX=--selinux-enabled=false
And then
Systemctl daemon-reload
Systemctl restart docker
Then edit the contents of the file as follows:
Vi flannel_docker_opts.envDOCKER_OPTS= "--registry-mirror= https://xxxxx.mirror.aliyuncs.com"
After saving, start the docker service
Systemctl daemon-reloadsystemctl restart docker
Finally, verify.
Ps aux | grep dockerroot 831 1.3 0.8 272276 32908? Ssl 16:55 0:00 / run/torcx/bin/dockerd-host=fd://-containerd=/var/run/docker/libcontainerd/docker-containerd.sock-selinux-enabled=true-registry-mirror= https://xxxxx.mirror.aliyuncs.com
It's a success. It's very simple.
Add:
Have you found that the path to the docker.service configuration file is under / run/? I have always found that / run/ should be run time, and sure enough, after the system or service is restarted, the configuration in docker.service is often restored. After trying to solve the problem, we can deal with it in the following ways:
# copy the configuration file in / run/ to / etc/ cp / run/systemd/system/docker.service / etc/systemd/system/docker.service# restart service systemctl daemon-reload# restart service systemctl restart docker.service# verify systemctl cat docker.service
This is how to configure the Docker image accelerator in the CoreOS shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.