New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline steps unable to connect to host the agent is running on #2293

Closed
shnhrrsn opened this Issue Jan 8, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@shnhrrsn

shnhrrsn commented Jan 8, 2018

I'm running into a strange networking issue where pipeline steps are unable to connect to a domain that resolves to the same host the agent is running on.

As far as I've been able to isolate, this is specifically related to Drone as I've confirmed both the host itself and containers ran directly on the host can connect.

Here’s my pipline config:

pipeline:

  test:
    image: byrnedo/alpine-curl
    commands:
      - ping -c 1 HOST
      - curl -s http://ifconfig.co
      - curl --connect-timeout 5 http://HOST

And the output when it’s ran:

+ ping -c 1 HOST
PING HOST (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: seq=0 ttl=64 time=0.199 ms
--- HOST ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.199/0.199/0.199 ms
+ curl -s http://ifconfig.co
1.1.1.1
+ curl --connect-timeout 5 http://HOST
curl: (28) Connection timed out after 5001 milliseconds

When I run the same command on the host, they run fine:

root@host01:~# curl --connect-timeout 5 http://HOST
<html>
<head>

To ensure this isn’t a Docker issue, I also tested running the image/command from the pipeline above directly in Docker:

root@host01:~# docker run byrnedo/alpine-curl --connect-timeout 5 http://HOST
<html>
<head>

I believe this may also be related to drone-plugins/drone-docker#156

@bradrydzewski

This comment has been minimized.

Show comment
Hide comment
@bradrydzewski

bradrydzewski Jan 8, 2018

Member

hey there, we have a discourse thread for user support. We can re-open if we determine this is a drone issue, however, we I think we've seen this before [1] and it is related to host machine network setup with respect to user-defined docker networks.

Your example running from the command line does not entirely mirror how drone is running the container. You would need to create and attach a network, like this:

docker network create foo
docker run --network=foo byrnedo/alpine-curl /bin/sh -c "curl --connect-timeout 5 http://HOST"

Sometimes this can be resolved with host machine IP tables rules. Other times it can be resolved by providing http_proxy, https_proxy and no_proxy variables. Depends on the host machine configuration and root cause.

[1] https://discourse.drone.io/t/dind-container-not-receiving-host-resolv-conf-settings/811/2

Member

bradrydzewski commented Jan 8, 2018

hey there, we have a discourse thread for user support. We can re-open if we determine this is a drone issue, however, we I think we've seen this before [1] and it is related to host machine network setup with respect to user-defined docker networks.

Your example running from the command line does not entirely mirror how drone is running the container. You would need to create and attach a network, like this:

docker network create foo
docker run --network=foo byrnedo/alpine-curl /bin/sh -c "curl --connect-timeout 5 http://HOST"

Sometimes this can be resolved with host machine IP tables rules. Other times it can be resolved by providing http_proxy, https_proxy and no_proxy variables. Depends on the host machine configuration and root cause.

[1] https://discourse.drone.io/t/dind-container-not-receiving-host-resolv-conf-settings/811/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment