Open bswilliamson opened 3 years ago
Do you see the same problem if you try to do the build with the "classic" builder?
You can temporarily disable BuildKit by setting the DOCKER_BUILDKIT=0
environment variable in the shell where you perform the build.
No that works fine. At least I can use that as a workaround.
@tonistiigi PTAL ^^
Buildkit does not send your password to the remote daemon, instead, it requests a temporary token from the client-side. That means that if you can't access the internet (auth server) your proxy settings need to be set on the docker
binary you are invoking.
The system proxy is already set in the terminal environment (see proxy configuration check above) and Invoke-WebRequest can successfully make requests. So docker must not be detecting the system proxy.
I've done some more testing and if I override the system proxy set via Windows settings with the http_proxy and https_proxy env vars in powershell then it does indeed work. However this means that I currently have proxy settings in three separate places in order for Docker Desktop to work:
Is this disparity between the GUI and the CLI the intended behaviour?
No, it's not intended, we've obviously missed passing the configuration around in the change from classic builder to buildkit. We'll add another ticket to improve it. Thanks for the report.
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
/lifecycle frozen
@stephen-turner Did you add another ticket, and if so, could you share the reference please?
We have an internal ticket, not publicly visible.
/cc @crazy-max
Ta. Any idea when it might progress, just to set our expectations?
Sorry, no specific date at the moment.
I encounter the same (annoying) problem. However, everything worked fine at the time I started to use BuildKit when it was an experimental feature.
Any news on this? Took me around 3 hours until google finally showed the right entry about this issue.
Just ran into this tonight as well. Works perfectly fine with 'run' command then can't build because it can't pull dependencies.
Does not happen on Linux for me, only windows.
I was aware of this issue for a while now. But it became too annoying with Docker DevEnvironments. The devenv feature is kind-of GUI only (I had a bunch of other problems when trying to use the docker dev cli, so GUI usually works fine). The problem is that it fails to auth you when creating the environment, so you have to delete the devenv, move out of the VPN, and then re-create it, and then it starts building fine. But if you have a build step that requires you to be inside the VPN (e.g. fetching a binary from an internal artifact storage), then I guess you will be out of luck, and DevEnv will became unusable
I have the same issue with docker compose build
. Solved by setting DOCKER_BUILDKIT=0, in order to download the container layers, and then again setting DOCKER_BUILDKIT=1 for the remaining commands.
just run
export http_proxy=...
export https_proxy=...
before running the docker build command.
@Ali-Flt my comment was for docker dev environments, which is another place where this problem shows up. Based from the docs at https://docs.docker.com/engine/reference/commandline/cli/#environment-variables, the variables needs to be capitalized, so it will be:
export HTTP_PROXY=XXX
export HTTPS_PROXY=XXX
export NO_PROXY=XXX
docker dev create $(pwd) --open
So this command fails when you don't have the base image in your local registry already. A workaround is: docker pull <base image>
, then docker compose -f compose-dev.yml build <dev environment>
and then docker dev create ...
At the time I wrote that comment, the docker dev cli was not working properly in my environment, so the only way to do this was to use the GUI. As today the docker dev cli works fine, it just still run into the problem described in the issue. So all our developers have to pull the base image before creating the dev environment (or switch out of the proxied VPN while building the environment)
@Ali-Flt my comment was for docker dev environments, which is another place where this problem shows up. Based from the docs at https://docs.docker.com/engine/reference/commandline/cli/#environment-variables, the variables needs to be capitalized, so it will be:
export HTTP_PROXY=XXX export HTTPS_PROXY=XXX export NO_PROXY=XXX docker dev create $(pwd) --open
So this command fails when you don't have the base image in your local registry already. A workaround is:
docker pull <base image>
, thendocker compose -f compose-dev.yml build <dev environment>
and thendocker dev create ...
At the time I wrote that comment, the docker dev cli was not working properly in my environment, so the only way to do this was to use the GUI. As today the docker dev cli works fine, it just still run into the problem described in the issue. So all our developers have to pull the base image before creating the dev environment (or switch out of the proxied VPN while building the environment)
Capitalized env still cannot work for docker pull
. Is there any update now?
I'm in Iran and I have this issue two . I tried docker build on my ubuntu server outside of Iran and its working . but in Iran and even with the proxy settings (both terminal ENV vars and conf files) not working for me . though when I put the https://auth.docker.io/token link manually in the browser (I have set proxy settings for my desktop and link works fine with browser) I will receive the response and I see the token value . what is this exactly ?
certainly there is a big bug . it does not make any sense at all . this issue is open since 3 GOD DAMN years ago and nobody has a good answer for it .
I just love that answer from this dude , like we were incapable to set a HTTP/HTTPS proxy for ourselves @ali
just run
export http_proxy=... export https_proxy=...
before running the docker build command.
Hello, i'm try to put my two cents in this problem...
My environment has two enterprise proxys: proxy1.test.com and proxy2.test.com.
So, in the linux VMs has this configuration:
/etc/environment
HTTPS_PROXY=http://proxy1.test.com
/etc/systemd/system/docker.service.d/http-proxy.conf
[Service] Environment="HTTP_PROXY=proxy2.test.com" Environment="HTTPS_PROXY=proxy2.test.com"
So, the default proxy should be proxy1.test.com and docker requersts should use proxy2.test.com.
The test scenario is: run docker build
using the dockerfile FROM server1.com/blabla
. The expected result is download the image server.com/blabla and create a new image locally.
With buildkit: The result is a problem with authentication, becase it is using the CLI HTTPS_PROXY(proxy1.test.com).
Without buildkit(set DOCKER_BUILDKIT=0): The result is the same as expected. It downloads and creates the image bevause use the proxy2.test.com
So basically, buildkit uses the proxy variables from CLI to authenticate to registries, and then to download the images, docker uses the daemon setting.
To solve the problem, I set my default proxy to be proxy2.test.com and hope it can handle all the requests
actually I searched a lot and I found a mirror for docker in my country , and also I used docker desktop in windows and everything worked perfect . but for some reason which I don't know , in Linux nothing works fine with docker . and actually it doesn't make any sense . I gave up using docker and instead I installed prerequisites on my remote ubuntu server and configured my project manually . it's working fine now .
but if you want to use docker at any cost , I suggest you to use docker desktop and set these settings in docker desktop application on windows .
Actual behavior
docker build
does not respect Docker Desktop proxy settings and fails to pull an image butdocker pull
can successfully pull the same image.Expected behavior
docker build
should be able to pull any images thatdocker pull
can.Information
My network environment requires me to use a proxy to access external sites. I have a proxy configured in Docker Desktop and system wide in Windows settings using a PAC file. I can successfully pull images using
docker pull
but I cannot build images becausedocker build
fails with a timeout onauth.docker.io
. Restarting the docker daemon has no impact and I have double checked my proxy config as shown below.Proxy configuration check
Steps to reproduce the behavior
Pull image successfully
Build image based on the same image after removing (fails)