https://prefect.io logo
p

Philip MacMenamin

01/25/2021, 7:56 PM
issues connecting to graphql:4200 on docker Hi, I'm trying to run the docker agent similar to https://github.com/PrefectHQ/server/issues/25 and am still unable to connect to the container it seems:
Copy code
requests.exceptions.ConnectionError: HTTPConnectionPool(host='host.docker.internal', port=4200): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd0e8943640>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
^C[2021-01-25 19:55:03,534] INFO - agent | Keyboard Interrupt received: Agent is shutting down.
it looks like the prefect flow container is just not setting the docker --network host? Maybe?
similar to @Riley Hun I get:
Copy code
>>> from prefect.utilities.docker_util import get_docker_ip
>>> print(get_docker_ip())
172.17.0.1
k

Kyle Moon-Wright

01/25/2021, 8:15 PM
Hmm, definitely not my area of expertise but it looks like there's a thread with a similar error that was resolved by adding docker0 to the trusted zone among other firewall/network related configurations.
upvote 1
p

Philip MacMenamin

01/27/2021, 3:57 AM
ok - this was related to firewall, in my case
ufw
to fix I edited
/etc/ufw/after.rules
Copy code
adding
# BEGIN UFW AND DOCKER
*filter
:ufw-user-forward - [0:0]
:DOCKER-USER - [0:0]
-A DOCKER-USER -j RETURN -s 10.0.0.0/8
-A DOCKER-USER -j RETURN -s 172.16.0.0/12
-A DOCKER-USER -j RETURN -s 192.168.0.0/16

-A DOCKER-USER -j ufw-user-forward

-A DOCKER-USER -j DROP -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 192.168.0.0/16
-A DOCKER-USER -j DROP -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 10.0.0.0/8
-A DOCKER-USER -j DROP -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 172.16.0.0/12
-A DOCKER-USER -j DROP -p udp -m udp --dport 0:32767 -d 192.168.0.0/16
-A DOCKER-USER -j DROP -p udp -m udp --dport 0:32767 -d 10.0.0.0/8
-A DOCKER-USER -j DROP -p udp -m udp --dport 0:32767 -d 172.16.0.0/12

-A DOCKER-USER -j RETURN
COMMIT
# END UFW AND DOCKER
I then ran
ufw allow 4200
restarted the agent, and it seems ok.