1.配置Docker的加速器及数据目录
[root@node1 ~]# mkdir /etc/docker
[root@node1 ~]# mkdir /data/docker -p
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"graph": "/data/docker",
"storage-driver": "overlay2",
"insecure-registries": ["registry.access.redhat.com","quay.io"],
"registry-mirrors": ["https://meme61ip.mirror.aliyuncs.com"],
"bip": "172.7.99.1/24",
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true
}
EOF
# 相关解释
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"graph": "/data/docker", # docker工作目录
"storage-driver": "overlay2", # 存储驱动
"insecure-registries": ["registry.access.redhat.com","quay.io"], # 不安全的仓库
"registry-mirrors": ["https://meme61ip.mirror.aliyuncs.com"], # 加速镜像
"bip": "172.7.99.1/24", # docker的网络,尽量要与宿主机有个对照关系
"exec-opts": ["native.cgroupdriver=systemd"], # cgroup的类型
"live-restore": true # 让docker容器不依懒docker引擎的死与活
}
EOF
2.启动Docker
[root@node1 ~]# systemctl enable docker.service
[root@node1 ~]# systemctl start docker.service
3.核查docker配置及启动情况
[root@node1 ~]# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.5
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.15.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 972.3MiB
Name: node1.hebye.com
ID: 3FGV:P5KT:WQQR:Y3U2:L4S2:CHUD:LREU:2ZB4:MOFU:FKJ3:RZJO:FMVK
Docker Root Dir: /data/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
registry.access.redhat.com
quay.io
127.0.0.0/8
Registry Mirrors:
https://meme61ip.mirror.aliyuncs.com/
Live Restore Enabled: true
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
[root@node1 ~]#
文档更新时间: 2021-03-17 18:55 作者:xtyang