美文网首页
docker端口占用

docker端口占用

作者: 土豆与番茄 | 来源:发表于2019-05-30 11:05 被阅读0次

    ERROR:for server  Cannotstart service server: driver failed programming external connectivityon endpoint server_1 (2bf20c2fa34592fa3c62178c384c2b1697ca5742af28ed7b25b1261bdd0908b9):Bind

     for 0.0.0.0:5002 failed: port is alreadyallocated

    ERROR:for server  Cannot start server: driver failed programming external connectivity on endpoint server_1(2bf20c2fa34592fa3c62178c384c2b1697ca5742af28ed7b25b1261bdd0908b9): Bind for0.0.0.

    0:5002failed: port is already allocatedERROR: Encountered errors while bringing upthe project.

    描述:gitlab CI时,docker-compose部署服务时,报错端口被占用,且端口不能改变

    方法:

    1.使用docker-compose down server

    netstat-anput | grep 5002

    在启动看看是否可用

    2.删除镜像/网络/容器/挂在目录

     docker network rm serverID

     docker container rm  serverID

     docker volume rm   serverID

     docker image rm serverID

    重启server

    3.重启docker

    systemctlrestart docker

    4.没测试(慎用,有可能将所有服务的network删除)

    sudo cp/var/lib/docker/network/files/local-kv.db /var/lib/docker/network/files/local-kv.db_bk

    sudo rm/var/lib/docker/network/files/local-kv.db

    sudodocker-compose up -d

    相关文章

      网友评论

          本文标题:docker端口占用

          本文链接:https://www.haomeiwen.com/subject/awdjvxtx.html