Skip to content
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

Colima does not auto-replace gateway address for proxy variables in docker daemon.json #1144

Closed
1 of 5 tasks
rteeling-evernorth opened this issue Sep 27, 2024 · 0 comments · Fixed by #1145
Closed
1 of 5 tasks

Comments

@rteeling-evernorth
Copy link
Contributor

Description

When running behind a corporate proxy that runs on127.0.0.1:9000, colima automatically translates the proxy env vars to 192.168.5.2:9000, but does not translate the proxy urls for /etc/docker/daemon.json

Version

colima version 0.7.5
git commit: 1588c06

runtime: docker
arch: aarch64
client: v27.3.1
server: v27.1.1
limactl version 0.23.2
qemu-img version 9.1.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

> colima status
INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] socket: unix:///Users/c43990/.colima/default/docker.sock

Reproduction Steps

  1. Set http proxy variables to http://127.0.0.1:9000
  2. colima start --vm-type=vz --vz-rosetta=true
  3. colima ssh -- env | grep -i will reveal env vars have the translated proxy url (http://192.165.5.2:9000)
  4. colima ssh -- cat /etc/docker/daemon.json to read daemon.json file

Expected behaviour

Expected /etc/docker/daemon.json

{
  "exec-opts": [
    "native.cgroupdriver=cgroupfs"
  ],
  "features": {
    "buildkit": true
  },
  "proxies": {
    "http-proxy": "http://192.168.5.2:9000",
    "https-proxy": "http://192.168.5.2:9000",
    "no-proxy": "localhost,192.168.5.2"
  }
}

Actual /etc/docker/daemon.json

{
  "exec-opts": [
    "native.cgroupdriver=cgroupfs"
  ],
  "features": {
    "buildkit": true
  },
  "proxies": {
    "http-proxy": "http://127.0.0.1:9000",
    "https-proxy": "http://127.0.0.1:9000",
    "no-proxy": "REDACTED"
  }

Additional context

The code that should do this resides here:

if vars := d.proxyEnvVars(env); !vars.empty() {
proxyConf := map[string]any{}
if vars.http != "" {
proxyConf["http-proxy"] = vars.http
}
if vars.https != "" {
proxyConf["https-proxy"] = vars.https
}
if vars.no != "" {
proxyConf["no-proxy"] = vars.no
}
conf["proxies"] = proxyConf
}

#1040 is an effective workaround, but it would be much more convenient and user friendly to set this automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant