##(1)编辑自启动的配置文件
sudo vim /usr/lib/systemd/system/docker.service
原有配置:
[Service]
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
新配置:
[Service]
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
:wq!保存退出
##(2)重新加载
sudo systemctl daemon-reload
sudo systemctl restart docker
##(3)测试
curl -X GET http://127.0.0.1:2375/images/json
##返回结果,代表成功
[{"Containers":-1,"Created":1683221823,"Id":"sha256:9c7a54a9a43cca047013b82af109fe963fde787f63f9e016fdc3384500c2823d","Labels":null,"ParentId":"","RepoDigests":["hello-world@sha256:fc6cf906cbfa013e80938cdf0bb199fbdbb86d6e3e013783e5a766f50f5dbaa0"],"RepoTags":["hello-world:latest"],"SharedSize":-1,"Size":13256,"VirtualSize":13256}]
10-24
8992
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-23
972
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-12
722
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-12
916
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-01
1064
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)