-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Pulling docker images from behind a company VPN #294
Comments
Can you try the following? Note: this assumes Colima v0.4.0 or newer.
|
Thank you very much, that is exactly what I needed! Works perfectly now. One follow on question - after doing the above, then completely deleting colima with colima stop, colima delete, brew uninstall colima and deleting the ~/.colima folder, when I reinstall and create a new colima VM, my proxy environment variables are already there! Do you know how they are getting populated / where they are cached, even beyond a complete uninstall? Thanks again |
Proxy environment variables ( The issue is that Docker's init file does not utilise the environment variables by default. In your case after the reinstall, I would not expect your Docker commands to outrightly work as before, but the environment variables will be present. |
Fantastic, thank you so much for your help, you've unblocked us! Appreciate your time :) |
Now that the issue is known, a proper fix will be worked on so you would not need to manually edit the init script. Thanks. |
I solved it this way:
Append:
|
@mdavino this can be handled automatically by Colima. Thanks for the information. |
@abiosoft ubuntu services are started by systemd. Then, the indicated workaround editing /etc/init.d/docker don't work for me. Thanks. Footnotes |
Thanks @abiosoft ! |
Even after following the steps above for adding the proxy, I'm getting this error: I'm using Mac M1 with Sonoma 14.3.1. |
Meanwhile, I'm on Mac Sonoma 14.6.1 and colima 0.7.3. I now have to provide the proxy environment variables as well in ➜ ~ printenv | grep _proxy
http_proxy=http://localhost:3128
https_proxy=http://localhost:3128
all_proxy=http://localhost:3128
no_proxy=localhost,127.0.0.1 In the # Environment variables for the virtual machine.
# If you use `preproxy`, provide your http_proxy and https_proxy env variables, and replace localhost with `192.168.5.2` (the lima loopback address https://lima-vm.io/docs/config/network/#host-ip-19216852),
# to make sure that the `proxies` value in /etc/docker/daemon.json is populated accordingly.
env:
http_proxy: http://192.168.5.2:3128
https_proxy: http://192.168.5.2:3128 This ensures that ➜ ~ colima ssh
gu77qc@colima:/Users/gu77qc$ sudo cat /etc/docker/daemon.json
{
"exec-opts": [
"native.cgroupdriver=cgroupfs"
],
"features": {
"buildkit": true
},
"proxies": {
"http-proxy": "http://192.168.5.2:3128",
"https-proxy": "http://192.168.5.2:3128",
"no-proxy": "localhost,127.0.0.1"
}
} Without these changes (so In my case, removing the For completeness sake, below you can find the output without and with my changes: Without changes -- ➜ ~ colima start --arch x86_64 --cpu 4 --memory 4
INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] starting ... context=vm
INFO[0057] provisioning ... context=docker
INFO[0063] starting ... context=docker
INFO[0068] done
➜ ~ docker pull hello-world
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 127.0.0.1:3128: connect: connection refused
➜ ~ colima ssh
gu77qc@colima:/Users/gu77qc$ sudo cat /etc/docker/daemon.json
{
"exec-opts": [
"native.cgroupdriver=cgroupfs"
],
"features": {
"buildkit": true
},
"proxies": {
"http-proxy": "http://localhost:3128",
"https-proxy": "http://localhost:3128",
"no-proxy": "localhost,127.0.0.1"
}
gu77qc@colima:/Users/gu77qc$ exit
logout
➜ ~ colima stop
INFO[0000] stopping colima
INFO[0000] stopping ... context=docker
INFO[0002] stopping ... context=vm
INFO[0006] done Update env:
http_proxy: http://192.168.5.2:3128
https_proxy: http://192.168.5.2:3128 ➜ ~ colima start --arch x86_64 --cpu 4 --memory 4
INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0002] starting ... context=vm
INFO[0051] provisioning ... context=docker
INFO[0058] starting ... context=docker
INFO[0063] done
➜ ~ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:53cc4d415d839c98be39331c948609b659ed725170ad2ca8eb36951288f81b75
Status: Image is up to date for hello-world:latest
docker.io/library/hello-world:latest
➜ ~ colima ssh
gu77qc@colima:/Users/gu77qc$ sudo cat /etc/docker/daemon.json
{
"exec-opts": [
"native.cgroupdriver=cgroupfs"
],
"features": {
"buildkit": true
},
"proxies": {
"http-proxy": "http://192.168.5.2:3128",
"https-proxy": "http://192.168.5.2:3128",
"no-proxy": "localhost,127.0.0.1"
}
} |
The init script editing worked for me! Strange that init scripts still exist in 2024 :) It'd be great if this stuff could be synced from the macOS System Settings. |
Hey I've been struggling to apply the correct proxy settings to the colima vm so that I can pull docker images. I've tried various methods with no success, mostly from this thread: https://stackoverflow.com/questions/23111631/cannot-download-docker-images-behind-a-proxy
The most common method seems to be creating
/etc/systemd/system/docker.service.d/http-proxy.conf
and applyingHTTP_PROXY
,HTTPS_PROXY
andNO_PROXY
like this:...but I've had no success with that. I've also tried adding to
daemon.json
with no success:I managed to get it working before colima was switched to alpine, but what is the correct method now? Thanks for your help!
The text was updated successfully, but these errors were encountered: