赞
踩
vi /usr/lib/systemd/system/docker.service
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
systemctl stop firewalld
firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-ports
[root@localhost ~]# systemctl stop docker.socket
[root@localhost ~]# systemctl daemon-reload && systemctl start docker
[root@localhost ~]# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since 二 2023-08-22 17:46:00 CST; 14s ago Docs: https://docs.docker.com Main PID: 8219 (dockerd) Tasks: 7 Memory: 24.3M CGroup: /system.slice/docker.service └─8219 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.266423902+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.290199031+08:00" level=info msg="[graphdriver] using prior storage driver: overlay2" 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.308690375+08:00" level=info msg="Loading containers: start." 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.499669329+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0...IP address" 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.527983877+08:00" level=info msg="Loading containers: done." 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.562405494+08:00" level=info msg="Docker daemon" commit=3056208 graphdriver(s)=overlay2 version=20.10.21 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.562786361+08:00" level=info msg="Daemon has completed initialization" 8月 22 17:46:00 localhost.localdomain systemd[1]: Started Docker Application Container Engine. 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.601480387+08:00" level=info msg="API listen on /var/run/docker.sock" 8月 22 17:46:00 localhost.localdomain dockerd[8219]: time="2023-08-22T17:46:00.602129704+08:00" level=info msg="API listen on [::]:2375" Hint: Some lines were ellipsized, use -l to show in full. [root@localhost ~]#
[root@localhost ~]# curl http://192.168.11.48:2375/version
{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"20.10.21","Details":{"ApiVersion":"1.41","Arch":"amd64","BuildTime":"2022-10-25T18:02:38.000000000+00ommit":"3056208","GoVersion":"go1.18.7","KernelVersion":"3.10.0-1160.el7.x86_64","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"1.6.10","Details":{"GitCommit":"770bd0108},{"Name":"runc","Version":"1.1.4","Details":{"GitCommit":"v1.1.4-0-g5fd4c4d"}},{"Name":"docker-init","Version":"0.19.0","Details":{"GitCommit":"de40ad0"}}],"Version":"20.10.21","ApiVersion":"Commit":"3056208","GoVersion":"go1.18.7","Os":"linux","Arch":"amd64","KernelVersion":"3.10.0-1160.el7.x86_64","BuildTime":"2022-10-25T18:02:38.000000000+00:00"}
[root@localhost ~]#
![在这里插入图片描述](https://img-blog.csdnimg.cn/8c04fb8f529b4347acd14cf54e75b239.png
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。