Skip to content

✨ Dagger: set buildkit network proxy #2053

Closed

Description

@lyzhang1999

What are you trying to do?

I have problem with access github and some domain with my network, when I do some plans it required that resource, It got network error.

Why is this important to you?

No response

How are you currently working around this?

set global proxy for my PC.

Activity

  1. shykes commented on Apr 8, 2022

    @shykes
    Contributor

    Related: #1369

  2. nipuna-perera commented on Apr 18, 2022

    @nipuna-perera
    Contributor

    I can help test this as I am behind a corp proxy

  3. marcosnils commented on Apr 19, 2022

    @marcosnils
    Contributor

    That's awesome @nipuna-perera! cc @grouville

  4. grouville commented on Apr 19, 2022

    @grouville
    Member

    I can help test this as I am behind a corp proxy

    Thanks @nipuna-perera. Could you please ping me on Discord privately ?

  5. ksaito1125 commented on Apr 19, 2022

    @ksaito1125

    Hello

    Reproduce as follows.

    Internet Direct is successful.

    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ git status
    HEAD detached at v0.2.4
    nothing to commit, working tree clean
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ dagger do build > log.txt 2>&1
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ echo $?
    0
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ tail -2 log.txt
    {"level":"info","task":"actions.build.run._exec","time":"2022-04-20T08:03:54+09:00","time":"2022-04-20T08:03:54+09:00","caller":"/home/runner/work/dagger/dagger/client/client.go:316","message":"#14 8.466 "}
    {"level":"info","task":"actions.build.run._exec","time":"2022-04-20T08:03:54+09:00","time":"2022-04-20T08:03:54+09:00","caller":"/home/runner/work/dagger/dagger/client/client.go:316","message":"#14 8.536 Done in 7.82s."}
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$
    

    It fails with VPN.

    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ dagger do build > log.txt 2>&1
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ echo $?
    1
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ tail -2 log.txt
    {"level":"error","task":"actions.deps._dag.\"0\"._dag.\"0\"._op","duration":90067.1142,"error":"failed to copy: httpReadSeeker: failed open: failed to do request: Get \"https://registry-1.docker.io/v2/library/alpine/manifests/sha256:2689e157117d2da668ad4699549e55eba1ceb79cb7862368b30919f0488213f4\": dial tcp 54.83.254.98:443: i/o timeout\n","state":"failed","time":"2022-04-20T08:35:53+09:00","time":"2022-04-20T08:35:53+09:00","caller":"/home/runner/work/dagger/dagger/plan/runner.go:164","message":"failed"}
    {"level":"fatal","error":"task failed: actions.deps._dag.\"0\"._dag.\"0\"._op: failed to copy: httpReadSeeker: failed open: failed to do request: Get \"https://registry-1.docker.io/v2/library/alpine/manifests/sha256:2689e157117d2da668ad4699549e55eba1ceb79cb7862368b30919f0488213f4\": dial tcp 54.83.254.98:443: i/o timeout\n\n","time":"2022-04-20T08:35:53+09:00","time":"2022-04-20T08:35:53+09:00","caller":"/home/runner/work/dagger/dagger/cmd/dagger/cmd/do.go:84","message":"failed to execute plan"}
    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$
    

    In the VPN environment, proxy proxy was set as follows.

    environment variables

    ubuntu@docker-net:~/dagger/pkg/universe.dagger.io/examples/todoapp$ env | grep -i proxy
    no_proxy=localhost,127.0.0.1,mydomain
    https_proxy=http://proxy.mydomain:8080
    http_proxy=http://proxy.mydomain:8080
    

    docker daemon

    ubuntu@docker-net:~$ sudo -E systemctl edit docker
    ubuntu@docker-net:~$ sudo systemctl daemon-reload
    ubuntu@docker-net:~$ sudo systemctl restart docker
    ubuntu@docker-net:~$ docker info 2>&1 | grep -i proxy
     HTTP Proxy: http://proxy.mydomain:8080
     HTTPS Proxy: http://proxy.mydomain:8080
     No Proxy: localhost,127.0.0.1,169.254.169.254,169.254.170.2,.mydomain
    ubuntu@docker-net:~$ docker run --rm hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    2db29710123e: Pull complete
    Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
    Status: Downloaded newer image for hello-world:latest
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    
    ubuntu@docker-net:~$
    
  6. nipuna-perera commented on Apr 22, 2022

    @nipuna-perera
    Contributor

    @grouville , I have pinged you on Discord. Do you still need help with this?

  7. marsmike commented on May 30, 2022

    @marsmike

    I can also help with this, located behind a proxy and dagger is not using the proxy env variables.

  8. juaruipav commented on Jun 30, 2022

    @juaruipav

    Guys, I'm also behind a proxy and I can do anything with dagger, same " temporary error (try again later)"

    Is there any update regarding this?

    Thanks,
    JJ

  9. grouville commented on Jun 30, 2022

    @grouville
    Member

    Thanks for the feedback, I had to pause it for a bigger feature. But I'll resume it starting tomorrow 😇

    If you think your issue is related to #2228, I'll have to dig a bit more because it's maybe a little too complex for me. Nevertheless, we prioritize it in the backlog 😇

  10. juaruipav commented on Jun 30, 2022

    @juaruipav

    Thanks for the feedback, I had to pause it for a bigger feature. But I'll resume it starting tomorrow 😇

    If you think your issue is related to #2228, I'll have to dig a bit more because it's maybe a little too complex for me. Nevertheless, we prioritize it in the backlog 😇

    Really appreciate the quick answer! It would be awesome if we can give dagger a try in our company. Count me in for the testing 💪

  11. samalba commented on Jun 30, 2022

    @samalba
    Contributor

    @juaruipav I tried a quick repro, I've setup an HTTP proxy on a remote box. Configured HTTP+HTTPS proxy my local Docker Desktop (using the Mac OS version 4.9.1 (81317)). I tried a simple dagger do and few curls from a dagger actions. I can see all the requests properly proxied via the remote http proxy. Can you share more about your setup?

  12. juaruipav commented on Jul 1, 2022

    @juaruipav

    @juaruipav I tried a quick repro, I've setup an HTTP proxy on a remote box. Configured HTTP+HTTPS proxy my local Docker Desktop (using the Mac OS version 4.9.1 (81317)). I tried a simple dagger do and few curls from a dagger actions. I can see all the requests properly proxied via the remote http proxy. Can you share more about your setup?

    Hi @samalba, sure here you have more details. Basically I'm using Ubuntu 18.04 behind a company proxy and using locally cntlm. One of the first steps of almost every example is to download alpine stuff via https, so we have the following output:

    [✗] actions.deps #8 0.325 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz #8 5.331 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz #8 5.331 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: temporary error (try again later) #8 10.34 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: temporary error (try again later) #8 10.34 ERROR: unable to select packages: #8 10.34 bash (no such package): #8 10.34 required by: world[bash]

    It's not a matter of connection because that .tar.gz is accesible via curl/wget. It looks like dagger internally is not using properly http_proxy/https_proxy ENV vars nor the docker network proxy configuration.

    Could it be in your case you have already those containers in your cache so you don't see the message from above?

    Regards,
    JJ

  13. samalba commented on Jul 1, 2022

    @samalba
    Contributor

    Thanks for the extra context, I retried with the env vars on the docker client and it skips the proxy this time. It confirms that Docker Desktop actually redirect all the network from the docker vm to the proxy. I'll look for a fix.

  14. self-assigned this
    on Jul 1, 2022
  15. samalba commented on Jul 5, 2022

    @samalba
    Contributor

    @juaruipav @marsmike @nipuna-perera if you have some time to spare, would you mind trying this fix? #2748 and confirm it works for you? I was able to forward all requests to a remote proxy successfully.

    To try it out, you'll simply need to set HTTP_PROXY or HTTPS_PROXY in the same session where you run dagger do.

  16. juaruipav commented on Jul 6, 2022

    @juaruipav

    @juaruipav @marsmike @nipuna-perera if you have some time to spare, would you mind trying this fix? #2748 and confirm it works for you? I was able to forward all requests to a remote proxy successfully.

    To try it out, you'll simply need to set HTTP_PROXY or HTTPS_PROXY in the same session where you run dagger do.

    Cool! Everything works as expected. Already commented in the PR. Thank you very much for the support! 👍

  17. samalba commented on Jul 7, 2022

    @samalba
    Contributor

    @juaruipav @marsmike @nipuna-perera The fix is shipped with v0.2.22 (released today). It should unblock you.

    As stated in #2756, it's possible that some calls escape the proxy (unlikely since most universe packages are built on core.#Exec) - but if anything breaks, please report it!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions