docker深入2-linux下的設定檔daemon.json使用樣本

來源:互聯網
上載者:User

標籤:docker   daemon.json   devicemapper   registry-mirrors   insecure-registries   

docker深入2-linux下的設定檔daemon.json使用樣本

2016/12/9


一、現狀1、預設沒有這個設定檔,手動建立一個即可。2、我們目前使用過的操作在“docker深入2-儲存驅動之使用devicemapper(direct-lvm)模式”這一節中,我們是這樣操作的:---------------------------------------調整 daemon.json 的配置:[[email protected] ~]# cat /etc/docker/daemon.json{    "storage-driver": "devicemapper",    "storage-opts": [        "dm.thinpooldev=/dev/mapper/docker-thinpool",        "dm.use_deferred_removal=true",        "dm.use_deferred_deletion=true"    ]}---------------------------------------定義了 storage-driver 的值。然後重啟服務:[[email protected] ~]# systemctl restart docker && systemctl status docker -l這樣做的好處:調整配置時,不用去修改 docker.service的參數,通過設定檔來管理,更為清晰合理。二、探索1、linux上一個完整的配置樣本{    "api-cors-header": "",    "authorization-plugins": [],    "bip": "",    "bridge": "",    "cgroup-parent": "",    "cluster-store": "",    "cluster-store-opts": {},    "cluster-advertise": "",    "debug": true,    "default-gateway": "",    "default-gateway-v6": "",    "default-runtime": "runc",    "default-ulimits": {},    "disable-legacy-registry": false,    "dns": [],    "dns-opts": [],    "dns-search": [],    "exec-opts": [],    "exec-root": "",    "fixed-cidr": "",    "fixed-cidr-v6": "",    "graph": "",    "group": "",    "hosts": [],    "icc": false,    "insecure-registries": [],    "ip": "0.0.0.0",    "iptables": false,    "ipv6": false,    "ip-forward": false,    "ip-masq": false,    "labels": [],    "live-restore": true,    "log-driver": "",    "log-level": "",    "log-opts": {},    "max-concurrent-downloads": 3,    "max-concurrent-uploads": 5,    "mtu": 0,    "oom-score-adjust": -500,    "pidfile": "",    "raw-logs": false,    "registry-mirrors": [],    "runtimes": {        "runc": {            "path": "runc"        },        "custom": {            "path": "/usr/local/bin/my-runc-replacement",            "runtimeArgs": [                "--debug"            ]        }    },    "selinux-enabled": false,    "storage-driver": "",    "storage-opts": [],    "swarm-default-advertise-addr": "",    "tls": true,    "tlscacert": "",    "tlscert": "",    "tlskey": "",    "tlsverify": true,    "userland-proxy": false,    "userns-remap": ""}上述是官網docs提供的一個樣本配置,我們可以參考,選擇性的配置其中的部分內容。2、如何配置 registry 相關的參數涉及以下2個參數:    "insecure-registries": [],    "registry-mirrors": [],配置樣本:[[email protected] ~]# cat /etc/docker/daemon.json{    "storage-driver": "devicemapper",    "storage-opts": [        "dm.thinpooldev=/dev/mapper/docker-thinpool",        "dm.use_deferred_removal=true",        "dm.use_deferred_deletion=true"    ],    "registry-mirrors": [        "http://m.hub.test.com"    ],     "insecure-registries": [        "hub.test.com"    ]}        ZYXW、參考1、docshttps://docs.docker.com/engine/reference/commandline/dockerd/#/linux-configuration-file


docker深入2-linux下的設定檔daemon.json使用樣本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.