Docker - No route to host

前端 未结 8 943
予麋鹿
予麋鹿 2021-02-01 17:46

When i try and connect to a port from within my container to another container, i am unsuccessful and get,

root@ac1590a59fe5:/opt/f5massupgrade#         


        
8条回答
  •  孤街浪徒
    2021-02-01 18:35

    If anyone is still stuck with this problem on CentOS 8 or any system using firewalld

    try the following settings for firewalld

    # Allows container to container communication, the solution to the problem
    firewall-cmd --zone=public --add-masquerade --permanent
    
    # standard http & https stuff
    firewall-cmd --zone=public --add-port=80/tcp --permanent
    firewall-cmd --zone=public --add-port=443/tcp --permanent
    # + any other port you may need
    
    # reload the firewall
    firewall-cmd --reload
    

    you may also need to restart the docker service if it does not work immediately, there's no need to add the docker0 interface onto the trusted zone as many of the guides I've gone through stated

    I was struggling with setting up a Traefik reverse proxy for my docker containers, I only got 502 responses with a no route error to my container from Traefik logs. At first I thought it was my Traefik setup but it turned out it was the firewall restrictions as @al. mentioned. It pointed me in the right direction and I got my answer from https://serverfault.com/questions/987686/no-network-connectivity-to-from-docker-ce-container-on-centos-8

提交回复
热议问题