当我打印列表时
docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f15a180315d3 influxdb "/entrypoint.sh infl…" 2 hours ago Exited (128) 2 hours ago influxdb
7b753ba600df influxdb "/entrypoint.sh infl…" 3 hours ago Exited (0) 2 hours ago nervous_fermi
2ddc5d9af400 influxdb "/entrypoint.sh infl…" 3 hours ago Exited (0) 3 hours ago nostalgic_varahamihira
2e174a82d38d influxdb "/entrypoint.sh infl…" 3 hours ago Exited (0) 3 hours a modest_mestorf
但如果我尝试重启
docker container restart influxdb
我得到了
Error response from daemon: Cannot restart container influxdb: driver failed programming external connectivity on endpoint influxdb (06ee4d738dffecd1a202840699a899286f4bbb88392e4eb227d65670108687a6): Error starting userland proxy: listen tcp 0.0.0.0:8086: bind: address already in use
netstat -nl -p tcp | grep 8086
tcp6 0 0 :::8086 :::* LISTEN 1985/influxd
如何重启docker容器? 如果我去
docker kill influxdb
Error response from daemon: Cannot kill container: influxdb: Container f15a180315d38c2f5fac929b2d0b9be3e8ca2a09033648b5c5174c15a64c4d71 is not running
答案 0 :(得分:1)
<强>问题强>
如错误消息所示:
来自守护程序的错误响应:无法重启容器Influxdb:驱动程序无法在端点上编程外部连接Influxdb(06ee4d738dffecd1a202840699a899286f4bbb88392e4eb227d65670108687a6):启动userland代理时出错:listen tcp 0.0.0.0:8086:bind:地址已在使用中
端口8086已被另一个进程阻止(因此address already in use
部分)。因此容器无法运行,因为容器尝试启动influxdb
,但由于已绑定的端口而失败。
此外,netstat
的输出提供了提示,该进程占用端口:
netstat -nl -p tcp | grep 8086
tcp6 0 0 :::8086 :::* LISTEN 1985/influxd
(参见最后一部分:1985/influxd
)
<强>解决方案强>
杀死其他进程(首先检查,如果进程繁忙,您应该在停止之前保存数据),例如使用kill
命令:
kill 1985