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

Docker proxy settings problem #1040

Closed
1 of 5 tasks
magicgopher opened this issue Jun 10, 2024 · 10 comments
Closed
1 of 5 tasks

Docker proxy settings problem #1040

magicgopher opened this issue Jun 10, 2024 · 10 comments

Comments

@magicgopher
Copy link

Description

The daemon.json file does not take effect.
daemon.json configures the following content.

{
  "proxies": {
    "default": {
      "httpProxy": "http://127.0.0.1:7890",
      "httpsProxy": "http://127.0.0.1:7890",
      "noProxy": "localhost, 127.0.0.1"
    }
  }
}

Version

colima version 0.6.9
git commit: c3a31ed

runtime: docker
arch: aarch64
client: v26.1.4
server: v26.1.1

qemu-img version 9.0.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

limactl version 0.22.0

Operating System

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

Output of colima status

INFO[0000] colima is running using QEMU
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/{UserName}/.colima/default/docker.sock

Reproduction Steps

1.modify the daemon.json file to configure docker proxy
2.colima stop and colima start
3.after colima start, it is found that the proxy configured in daemon.json is not effective

Expected behaviour

After configuring docker proxy in daemon.json, the proxy should be used directly. However, when docker search or docker pull, it always shows proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused.

Specific commands.

docker search mysql
> Error response from daemon: Get "https://index.docker.io/v1/search?q=mysql&n=25": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused
docker pull mysql
> Using default tag: latest
> Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused

Additional context

No response

@magicgopher
Copy link
Author

I use docker desktop for mac and orbstack to configure docker proxy and it works

@magicgopher
Copy link
Author

colima.yaml configures provision, the specific contents are as follows

provision:
  - mode: system
    script: |
      CLASH_PROXY="127.0.0.1:7890"
      echo "{\"proxies\": {\"default\": {\"httpProxy\": \"http://$CLASH_PROXY\", \"httpsProxy\": \"http://$CLASH_PROXY\", \"noProxy\": \"localhost,127.0.0.1\"}}}" | sudo tee /etc/docker/daemon.json
      sudo systemctl daemon-reload
      sudo systemctl restart docker

@eunrui
Copy link

eunrui commented Jun 18, 2024

colima start --edit

go to the last line

env: 
    http_proxy: http://192.168.5.2:7890
    https_proxy: http://192.168.5.2:7890
    no_proxy: localhost,192.168.5.2

quit then execute command

colima ssh sudo systemctl daemon-reload
colima ssh sudo systemctl restart docker

it works for me

@magicgopher
Copy link
Author

colima start --edit

go to the last line

env: 
    http_proxy: http://192.168.5.2:7890
    https_proxy: http://192.168.5.2:7890
    no_proxy: localhost,192.168.5.2

quit then execute command

colima ssh sudo systemctl daemon-reload colima ssh sudo systemctl restart docker

it works for me

I have tried this method, but the colima virtual machine still does not use the proxy network.

@magicgopher
Copy link
Author

colima start --edit

go to the last line

env: 
    http_proxy: http://192.168.5.2:7890
    https_proxy: http://192.168.5.2:7890
    no_proxy: localhost,192.168.5.2

quit then execute command

colima ssh sudo systemctl daemon-reload colima ssh sudo systemctl restart docker

it works for me

Then I changed to the following method and it worked again.

provision:
  - mode: system
    script: |
      CLASH_PROXY="127.0.0.1:7890"
      echo "{\"proxies\": {\"default\": {\"httpProxy\": \"http://$CLASH_PROXY\", \"httpsProxy\": \"http://$CLASH_PROXY\", \"noProxy\": \"localhost,127.0.0.1\"}}}" | sudo tee /etc/docker/daemon.json
      sudo systemctl daemon-reload
      sudo systemctl restart docker

The .bash_profile file is configured

# proxy
function proxy_on() {
    export http_proxy="http://127.0.0.1:7890"
    export HTTP_PROXY="http://127.0.0.1:7890"
    export https_proxy="http://127.0.0.1:7890"
    export HTTPS_PROXY="http://127.0.0.1:7890"
}

# proxy off
function proxy_off() {
    unset http_proxy
    unset HTTP_PROXY
    unset https_proxy
    unset HTTPS_PROXY
}

@eunrui
Copy link

eunrui commented Jun 19, 2024

colima start --edit
go to the last line

env: 
    http_proxy: http://192.168.5.2:7890
    https_proxy: http://192.168.5.2:7890
    no_proxy: localhost,192.168.5.2

quit then execute command
colima ssh sudo systemctl daemon-reload colima ssh sudo systemctl restart docker
it works for me

I have tried this method, but the colima virtual machine still does not use the proxy network.

Did u use http://192.168.5.2:7890 Or http://127.0.0.1:7890 ?

@magicgopher
Copy link
Author

colima start --edit
go to the last line

env: 
    http_proxy: http://192.168.5.2:7890
    https_proxy: http://192.168.5.2:7890
    no_proxy: localhost,192.168.5.2

quit then execute command

it works for mecolima ssh sudo systemctl daemon-reload``colima ssh sudo systemctl restart docker

I have tried this method, but the colima virtual machine still does not use the proxy network.

Did u use http://192.168.5.2:7890 Or http://127.0.0.1:7890 ?

At first, I configured 127.0.0.1:7890 in the env property. Later, I saw similar problems in other issues and changed it to 192.168.5.2:7890. I found that no proxy was used.

@liqiujiong
Copy link

#294 (comment)

@magicgopher
Copy link
Author

#294 (comment)

thanks

@magicgopher
Copy link
Author

#294 (评论)

I tried the steps and found that the proxy was still not used.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Nov 20, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [abiosoft/colima](https://github.com/abiosoft/colima) | minor | `v0.7.5` -> `v0.8.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>abiosoft/colima (abiosoft/colima)</summary>

### [`v0.8.0`](https://github.com/abiosoft/colima/releases/tag/v0.8.0)

[Compare Source](abiosoft/colima@v0.7.6...v0.8.0)

#### Highlights

This is a new release to address compatibility issues with [Lima v1.0.0](https://github.com/lima-vm/lima/releases/tag/v1.0.0).

-   Colima now utilises virtualization.framework on macOS when Qemu is not available. Fixes [#&#8203;1188](abiosoft/colima#1188).
-   SSH port-forwarding is retained for Lima v1.0.0. Fixes [#&#8203;1181](abiosoft/colima#1181), [#&#8203;1184](abiosoft/colima#1184), [#&#8203;1185](abiosoft/colima#1185).

#### Other Updates

-   Nested Virtualization is now supported with the `--nested-virtualization` flag or `nestedVirtualization` config for m3 devices.
-   The default disk size is now 100GiB.

#### Commits

-   core: retain SSH port forwarder by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1182
-   core: make qemu an optional dependency by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1187

**Full Changelog**: abiosoft/colima@v0.7.6...v0.8.0

### [`v0.7.6`](https://github.com/abiosoft/colima/releases/tag/v0.7.6)

[Compare Source](abiosoft/colima@v0.7.5...v0.7.6)

#### Highlights

This release introduces the `colima update` command to update the container runtime version (e.g. Docker version) without needing to upgrade Colima or wait for the next release.

#### Other Fixes

-   Avoid error when docker-certs directory does not exist. Fixes [#&#8203;1128](abiosoft/colima#1128).
-   Update host-gateway-ip in proxy settings for docker daemon. Fixes [#&#8203;956](abiosoft/colima#956), [#&#8203;1040](abiosoft/colima#1040).

#### Commits

-   docker: avoid error where the cache docker-certs directory does not exist by [@&#8203;AlexanderOMara](https://github.com/AlexanderOMara) in abiosoft/colima#1129
-   build(deps): bump golang.org/x/term from 0.23.0 to 0.24.0 by [@&#8203;dependabot](https://github.com/dependabot) in abiosoft/colima#1133
-   docs: fixed typo on Apple Silicon in README by [@&#8203;analogsignals](https://github.com/analogsignals) in abiosoft/colima#1137
-   docker: replace 127.0.0.1 with host gateway ip in docker daemon.json proxy settings by [@&#8203;rteeling-evernorth](https://github.com/rteeling-evernorth) in abiosoft/colima#1145
-   ci: bump Go version by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1148
-   net: update vmnet by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1152
-   build(deps): bump golang.org/x/term from 0.24.0 to 0.25.0 by [@&#8203;dependabot](https://github.com/dependabot) in abiosoft/colima#1154
-   Minor updates by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1156
-   ci: use older qemu version by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1160
-   build(deps): bump github.com/fatih/color from 1.17.0 to 1.18.0 by [@&#8203;dependabot](https://github.com/dependabot) in abiosoft/colima#1171
-   cli: add update command by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1178
-   core: update disk images by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1179

#### New Contributors

-   [@&#8203;AlexanderOMara](https://github.com/AlexanderOMara) made their first contribution in abiosoft/colima#1129
-   [@&#8203;analogsignals](https://github.com/analogsignals) made their first contribution in abiosoft/colima#1137
-   [@&#8203;rteeling-evernorth](https://github.com/rteeling-evernorth) made their first contribution in abiosoft/colima#1145

**Full Changelog**: abiosoft/colima@v0.7.5...v0.7.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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

No branches or pull requests

3 participants