- I have several docker containers running on my macbook (later referred as HOST) as development servers. I usually start them when needed and stop them after use.
- I have proxy setting on the HOST, using ClashX.
- I use VSCode to remote attach to the containers.
- I want the containers have access to the proxy, even after I stop and restart them.
When I run a (new) container, I can use "--network host" parameter to instruct the container runs with host network setting, and it works. I can access the Gitlab with proxy.
But when I attach the vscode to the container, I cannot access the Gitlab anymore. It reports that it cannot connect to the 127.0.0.1:7890 which is my proxy.
I am wondering if vscode will change some network settings when it tries to attach to the container. If so, how should I prevent the VScode from doing so? Or if there are some other tricks?
Thanks!
I tried to start another container with "--network host". It works at first, but when VScode comes in, it fails again. I also tried to figure out if devcontainer in VSCode extension has something to do with this and tried to change the devcontainer's configuration. But it seems devcontainer is not for my way of working - having some persistent containers, instead of running from images all the time.