Docker/端口冲突:修订间差异
来自康健生活
< Docker
| (未显示同一用户的1个中间版本) | |||
| 第39行: | 第39行: | ||
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? | Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? | ||
</syntaxhighlight>|$|/home/kangkk}} | </syntaxhighlight>|$|/home/kangkk}} | ||
进入 docker | |||
{{shc|<syntaxhighlight lang="bash"> | |||
docker exec -it portait_xiangmu bash</syntaxhighlight>}} | |||
打印内部运行的 node.js 代码日志 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
docker logs -f -t --tail 20 238ad7c6fb8b</syntaxhighlight>}} | |||
2021年2月5日 (五) 03:42的最新版本
引言
常用命令
查看 docker 列表
docker image ls
查看代理
[jian@kang /home/kangkk]$
ps -aux | grep -v grep | grep docker-proxy
root 1452424 0.0 0.0 479196 3912 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8081 -container-ip 172.18.0.3 -container-port 8080
root 1452682 0.0 0.0 405464 4016 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5000 -container-ip 172.18.0.8 -container-port 5000
root 1452741 0.0 0.0 479196 3968 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8082 -container-ip 172.18.0.10 -container-port 80
root 1452816 0.0 0.0 405464 3908 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.18.0.11 -container-port 80
root 1453064 0.0 0.0 628068 3948 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9000 -container-ip 172.18.0.15 -container-port 9000
root 1453203 0.0 0.0 479196 4104 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8123 -container-ip 172.18.0.15 -container-port 8123
root 1453348 0.0 0.0 628068 3912 ? Sl 19:10 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5433 -container-ip 172.18.0.17 -container-port 5432
root 1489373 0.0 0.0 405464 4004 ? Sl 19:24 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8053 -container-ip 172.17.0.2 -container-port 8053
root 1489407 0.0 0.0 479196 3944 ? Sl 19:24 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8052 -container-ip 172.17.0.2 -container-port 80
查看 iptables
[jian@kang /home/kangkk]$
iptables -t nat -nL --line-number | grep 80
7 MASQUERADE tcp -- 172.18.0.2 172.18.0.2 tcp dpt:8080
8 MASQUERADE tcp -- 172.17.0.2 172.17.0.2 tcp dpt:8053
9 MASQUERADE tcp -- 172.17.0.2 172.17.0.2 tcp dpt:80
10 MASQUERADE tcp -- 172.18.0.6 172.18.0.6 tcp dpt:80
13 MASQUERADE tcp -- 172.18.0.18 172.18.0.18 tcp dpt:80
7 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8081 to:172.18.0.2:8080
8 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8053 to:172.17.0.2:8053
9 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8052 to:172.17.0.2:80
10 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:172.18.0.6:80
13 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8082 to:172.18.0.18:80
查看记录
[jian@kang /home/kangkk]$
docker ps -a | grep node-with-chrome
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
进入 docker
docker exec -it portait_xiangmu bash
打印内部运行的 node.js 代码日志
docker logs -f -t --tail 20 238ad7c6fb8b
No categories