typora/note/devops/docker/远程管理docker.md
2024-12-12 10:48:55 +08:00

34 lines
591 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### /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
```