因为工作的需要,需要把docker 启动后的路径改成/data,所以就会用到:/etc/docker/daemon.json 是 docker 的配置文件,默认是没有的,需要我们手动创建,可配置项如下:
具体的操作是:
1: 设置/etc/docker/daemon.json 文件.
2.创建并修改完daemon.json文件后,需要让这个文件生效
a.修改完成后reload配置文件
sudo systemctl daemon-reload
b.重启docker服务
sudo systemctl restart docker.service
c.查看状态
sudo systemctl status docker -l
d.查看服务
sudo docker info
[root@localhost ~]$ vim /etc/docker/daemon.json { ? ? "authorization-plugins": [], ? ? "data-root": "", ? # 设置docker运行时的根目录 ? ? "dns": [], ? ? ? ? # 设置容器的DNS地址 ? ? "dns-opts": [], ? ?# 设置容器的/etc/resolv.conf文件 ? ? "dns-search": [], ? ? "exec-opts": [], ? ? "exec-root": "", ? ? "experimental": false, ? ? "features": {}, ? ? "storage-driver": "", ? ? "storage-opts": [], ? ? "labels": [], ? ? "live-restore": true, ? ? "log-driver": "json-file", ? ? "log-opts": { ? ? ? ? "max-size": "10m", ? ? ? ? "max-files":"5", ? ? ? ? "labels": "somelabel", ? ? ? ? "env": "os,customer" ? ? }, ? ? "mtu": 0, ? ? "pidfile": "", ? ?# 设置docker守护进程的PID文件 ? ? "cluster-store": "",? ? ? "cluster-store-opts": {}, ? ? "cluster-advertise": "", ? ? "max-concurrent-downloads": 3, ? ? "max-concurrent-uploads": 5, ? ? "default-shm-size": "64M", ? ? "shutdown-timeout": 15, ? ? "debug": true, ? ?# 是否以debug模式启动docker ? ? "hosts": [], ? ? ?# 设置容器的hosts ? ? "log-level": "", ? ? "tls": true, ? ? "tlsverify": true, ? ? "tlscacert": "", ? ? "tlscert": "", ? ? "tlskey": "", ? ? "swarm-default-advertise-addr": "", ? ? "api-cors-header": "", ? ? "selinux-enabled": false, ? ?# 设置是否支持SELinux ? ? "userns-remap": "", ? ? "group": "", ? ? "cgroup-parent": "", ? ? "default-ulimits": { ? ? ? ? "nofile": { ? ? ? ? ? ? "Name": "nofile", ? ? ? ? ? ? "Hard": 64000, ? ? ? ? ? ? "Soft": 64000 ? ? ? ? } ? ? }, ? ? "init": false, ? ? "init-path": "/usr/libexec/docker-init", ? ? "ipv6": false, ? ? "iptables": false, ? ? "ip-forward": false, ? ? ? ? "ip-masq": false, ? ? "userland-proxy": false, ? ? "userland-proxy-path": "/usr/libexec/docker-proxy", ? ? "ip": "0.0.0.0", ? ? "bridge": "", ? ? "bip": "", ? ? "fixed-cidr": "", ? ? "fixed-cidr-v6": "", ? ? "default-gateway": "", ? ? "default-gateway-v6": "", ? ? "icc": false, ? ? "raw-logs": false, ? ? "allow-nondistributable-artifacts": [], ? ? "registry-mirrors": [], ? ? ? # 设置镜像加速地址 ? ? "seccomp-profile": "", ? ? "insecure-registries": [], ? ?# 设置docker的私有仓库地址 ? ? "no-new-privileges": false, ? ? "default-runtime": "runc", ? ? "oom-score-adjust": -500, ? ? "node-generic-resources": ["NVIDIA-GPU=UUID1", "NVIDIA-GPU=UUID2"], ? ? "runtimes": { ? ? ? ? "cc-runtime": { ? ? ? ? ? ? "path": "/usr/bin/cc-runtime" ? ? ? ? }, ? ? ? ? "custom": { ? ? ? ? ? ? "path": "/usr/local/bin/my-runc-replacement", ? ? ? ? ? ? "runtimeArgs": [ ? ? ? ? ? ? ? ? "--debug" ? ? ? ? ? ? ] ? ? ? ? } ? ? }, ? ? "default-address-pools":[{"base":"172.80.0.0/16","size":24}, ? ? {"base":"172.90.0.0/16","size":24}] }
更多参数配置:?docker配置参数详解---/etc/docker/daemon.json完整参数_一个单纯的程序员的博客-CSDN博客
|