typora/note/devops/docker/远程管理docker.md

34 lines
591 B
Markdown
Raw Permalink Normal View History

2024-12-11 21:48:55 -05:00
### /etc/docker/daemon.json
- 在原有基础上增加hosts部分
```json
{
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"]
}
```
### docker启动脚本systemctl service方式
- 停止dockersystemctl stop docker
- 修改/usr/lib/systemd/system/docker.service保留 dockerd就可以
![image-20240914172847794](https://blog-heysq-1255479807.cos.ap-beijing.myqcloud.com/typora/image-20240914172847794.png)
- systemctl daemon-reload
- systemctl start docker
- netstat -nlp | grep 2375
- lsof -i:2375
### 远程连接
```bash
docker -H192.168.0.3 ps
```