CoreOS下的Docker配置是通過flannel unit來實(shí)現(xiàn)的
通過命令可以看出配置文件的默認(rèn)位置
# /run/systemd/system/docker.service
[Unit]
Requires=torcx.target
After=torcx.target
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=containerd.service docker.socket network-online.target
Wants=network-online.target
Requires=containerd.service docker.socket
[Service]
EnvironmentFile=/run/metadata/torcx
Type=notify
EnvironmentFile=-/run/flannel/flannel_docker_opts.env
Environment=DOCKER_SELINUX=--selinux-enabled=true
/run/flannel/flannel_docker_opts.env
這個(gè)文件默認(rèn)是沒有的,所以我們創(chuàng)建對應(yīng)目錄和文件即可。
然后編輯文件內(nèi)容如下:
vi flannel_docker_opts.env
DOCKER_OPTS="--registry-mirror=https://xxxxx.mirror.aliyuncs.com"
保存后,啟動(dòng)docker服務(wù)即可
systemctl daemon-reload
systemctl restart docker
最后驗(yàn)證一下
root 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
這樣就成功了,很簡單吧。
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。