Did network setting have changed?

I use docker engine in ubuntu with version 20.10.23. I want to let docker container use proxy network in the host machine, but always failed.

I set the ~/.docker/config.json like Configure Docker to use a proxy server | Docker Documentation , but I can’t see HTTP_PROXY or HTTPS_PROXY env variable in the container. The proxy ip is, so I set the config.json ip with because of default bridge network.

I test if the container connects to proxy network with curl google Because of regional restrictions it will fail if it doesn’t use proxy network.

I use clash for windows to provide proxy network with allow LAN open, and use normally with host machine.

However, I still can’t connect to the proxy network in container. curl www.baidu.com is useful, but curl www.google.com is not.

So you are using Docker Desktop for Windows, and your proxy is running on Windows as well.
Is the wsl gateway ip, the windows host ip or something else?

Also, it’s important to know whether you are connected to a vpn or not - vpn connections have the tendency to block traffic from the wsl network to the host, and to modify routes that interfere with traffic to wsl.

In which wsl distribution do you run your command, is it docker-desktop or something else like ubuntu or a different distribution?

I use docker-engine, not docker desktop. is docker gateway.

By the way, I found the key point. I didn’t add my user to docker user group (so use docker by sudo docker). This leads to my config.json at /root/.docker/config.json rather than ~/.docker/config.json

Ah okay, then I got it all wrong. This made me assume you would use Windows, and therefor Docker Desktop of Windows:

I still have no idea how your setup looks exactly, but since you seem to have sorted out your issue, I think we can both live with that :slight_smile:

Update: I missed the Ubuntu part in your first post and only noticed “clash for windows”.