您的位置:首页 > 运维架构 > Docker

docker配置文件以及各种问题汇总---随笔

2018-01-24 14:11 651 查看
因为对docker了解不是深入(不是开发docker)。但把docker的配置文件研究透彻,会起到“事半功倍”的效果。下面只是随笔记一下,不能成为博客,若以后有深入研究,再详细整理。
【问题集锦】

问题1、一个已经停止的容器,再次启动报Unknown runtime specified docker-runc[root@localhost ~]# docker start 389fcaab1ca4
Error response from daemon: Unknown runtime specified docker-runc
Error: failed to start containers: 389fcaab1ca4
[root@localhost ~]# 解决方法:
[root@localhost containers]# vi /var/lib/docker/containers/容器ID/hostconfig.json

修改里面"Runtime":"docker-runc",修改为"Runtime":"runc"
原因:不详。

【配置集锦】
用户级配置文件:
/etc/docker/daemon.json(没有则自己创建)
daemon.json样例:
{    "api-cors-header": "",    "authorization-plugins": [],    "bip": "",    "bridge": "", /* 指定网桥 */    "cgroup-parent": "",    "cluster-store": "",    "cluster-store-opts": {},    "cluster-advertise": "",    "debug": true, /* 日志级别 如果是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": ""}

系统级配置文件:
/lib/systemd/system/docker.service  ---> 启动服务脚本:systemctl start docker 命令就是调用此配置文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐