今天启动docker容器时,突然报错:
driver failed programming external connectivity on endpoint
...
port is already allocated
判断原因为端口被占用。netstat命令查看端口占用情况:
yum install net-tools
netstat -lntp
发现在docker容器完全停止的情况下,80,9000等端口被docker-proxy进程占用。
重启docker服务后,docker-proxy进程消失。不再无故占用端口。docker容器又可正常启动了。
service docker stop
service docker start
以下为错误详细信息:
[root@localhost docker]# docker-compose restart
Restarting docker_cm_nginx_1 ... error
Restarting docker_cm_phpfpm72_1 ... error
Restarting docker_cm_mysql57_1 ... done
ERROR: for docker_cm_nginx_1 Cannot restart container 7f4c0873e6dfcfacab25c7933a5f0376d677c16a79b533f02f9b35da9a7d30f9: driver failed programming external connectivity on endpoint docker_cm_nginx_1 (ef8fdb08d6da369ad3228e91e1f1e56a2068493aefe81547b074acd346be095d): Bind for 0.0.0.0:80 failed: port is already allocated
ERROR: for docker_cm_phpfpm72_1 Cannot restart container ab250c8a93be02a668a76edf5a920ca8b8285e161cd623ba7e5ad5a278415766: driver failed programming external connectivity on endpoint docker_cm_phpfpm72_1 (f033d21a2b2a9394f87caafc8ddf95c6c31e4be724b4d4e2a7411c78558ad132): Bind for 0.0.0.0:9000 failed: port is already allocated
https://blog.csdn.net/AinUser/article/details/100126400
https://www.cnblogs.com/wintersoft/p/11812319.html