我发现如果我们停下来并移除容器
sudo docker run -d --restart unless-stopped --name=influxdb -p 8083:8083 -p 8086:8086 -p "25826:25826/udp" -v $PWD:/var/lib/influxdb influxdb
端口仍处于打开状态,
sudo lsof -n -P | grep 25826
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
docker-pr 1340 root 4u IPv6 24456 0t0 UDP *:25826
docker-pr 1340 1349 root 4u IPv6 24456 0t0 UDP *:25826
docker-pr 1340 1350 root 4u IPv6 24456 0t0 UDP *:25826
docker-pr 1340 1354 root 4u IPv6 24456 0t0 UDP *:25826
docker-pr 1340 1355 root 4u IPv6 24456 0t0 UDP *:25826
docker-pr 1340 1358 root 4u IPv6 24456 0t0 UDP *:25826
端口8083
$ sudo lsof -n -P | grep 8083
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
docker-pr 1415 root 4u IPv6 25306 0t0 TCP *:8083 (LISTEN)
docker-pr 1415 1418 root 4u IPv6 25306 0t0 TCP *:8083 (LISTEN)
docker-pr 1415 1419 root 4u IPv6 25306 0t0 TCP *:8083 (LISTEN)
docker-pr 1415 1420 root 4u IPv6 25306 0t0 TCP *:8083 (LISTEN)
docker-pr 1415 1421 root 4u IPv6 25306 0t0 TCP *:8083 (LISTEN)
和端口8086,
$ sudo lsof -n -P | grep 8086
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
docker-pr 1373 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
docker-pr 1373 1374 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
docker-pr 1373 1375 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
docker-pr 1373 1376 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
docker-pr 1373 1380 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
docker-pr 1373 1383 root 4u IPv6 25260 0t0 TCP *:8086 (LISTEN)
答案 0 :(得分:0)
我观察到了预期的行为:跑步时使用;停止后不再使用。
运行后:
ss --listening --processes | egrep "(808[36])|(25826)" | wc --lines
3
docker container stop influxdb
influxdb
ss --listening --processes | egrep "(808[36])|(25826)" | wc --lines
0
您确定要正确停止容器吗?