The requested URL returned error: 502 when running git clone inside a Docker container
I have a simple bash script
git clone https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/danechitoaie/open-pipelines-test1.git $BUILD_DIR that I run in a Docker container and the problem is that sometimes git clone fails with following error message
fatal: unable to access 'https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/danechitoaie/open-pipelines-test1.git/': The requested URL returned error: 502
This happens randomly, so sometimes it works sometimes I get this error.
Any idea what could the problem be?
2 Solutions collect form web for “The requested URL returned error: 502 when running git clone inside a Docker container”
I also get random 502 errors from bitbucket since yesterday, so I’d assume bitbucket has currently some issues.
The 502 http response means “Bad gateway”. So you have some kind of connection problem to the repository. I think the problem is not related to docker. Probably on the host machine containing your Docker containers you’ll have the same behavior if you try the git clone to the repository. Test it if you can.
You said it happens randomly. Are you behind a proxy or something similar? That issue happens sometimes under that proxy scenario. If that is your case, remember to put ENV var in your Dockerfiles with the proxy settings:
ENV http_proxy http://x.x.x.x:xxxx ENV https_proxy https://x.x.x.x:xxxx