Docker Remote API 配置
环境配置
- 操作系统:CentOS Stream release 9
- Docker:
- Docker Engine: 27.3.1
- Docker API:1.47
配置 Docker Remote API
sudo systemctl edit docker.service
删除所有内容,然后添加如下内容:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://127.0.0.1:2375
或者在这里添加(注意,不要在末尾添加,否则会被丢弃!)
### Editing /etc/systemd/system/docker.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://192.168.17.129:2375
### Lines below this comment will be discarded
第二个-H
处填127.0.0.1
的话,只能本机访问,访问的时候必须使用配置的ip访问。