Linux: Container application not running with web proxy, same application working on Docker desktop(mac) with proxy

1.I have installed docker desktop in mac and configured the web proxy, I have logged in to docker shell and running application , application connecting to proxy and working fine
2. I have installed docker.io(apt install docker.io) in linux and configured proxy

CMD:
docker run -it --rm -e http_proxy=http://:8080 -e https_proxy=http://:8080 sh
i have tried all below possibilities
added proxy details:
/etc/docker/daemon.json
{
“proxies”: {
“http-proxy”: “http://:8080”,
“https-proxy”: “http://:8080”
}
}

/etc/systemd/system/docker.service.d/http-proxy.conf OR override.conf

[Service]
Environment=“HTTP_PROXY=http://:8080/”
Environment=“HTTPS_PROXY=http://:8080/”

~/.docker/config.json
“proxies”: {
“default”: {
“httpProxy”: “http://:8080”,
“httpsProxy”: “http://:8080”
}
},
ISSUE::
In container application is running, all web request should go through the web proxy, but in my case not going through the proxy, i have verified packet and verified in proxy logs also

In docker container i’m running curl command “curl -v ”, this traffic going through the proxy, but application traffic not going through proxy,

Could you please help me on the same issue…!


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

After fixing your post, please send a new comment so people are notified about the fixed content.


You should start with an officially supported Docker CE

Or install Docker Desktop for Linux if you prefer that and you opened this topic in the Docker Desktop for Linux category.

Updated++

  1. I have installed docker desktop in mac and configured the web proxy, I have logged in to docker shell and running application , application connecting to proxy and working fine
  2. I have installed docker engine in linux and configured proxy container level and docker level

ISSUE::

  • If i run the application it will send the https request to get the info, in linux container not using the web proxy
  • I have captured the packets and verified the proxy logs, not finding the any request from linux host
  • If run curl or wget request receiving in proxy but application requests not receiving
  • example:: curl -v

CMD
docker run -it --rm -e http_proxy=http://:8080 -e https_proxy=http://:8080 sh

I have tried all below possibilities still my application not running with proxy

  • /etc/docker/daemon.json
{
    “proxies”: {
          “http-proxy”: “http://<ip>:8080”,
          “https-proxy”: “http://<ip>:8080”
    }
}
  • /etc/systemd/system/docker.service.d/http-proxy.conf OR override.conf
[Service]
Environment=“HTTP_PROXY=http://<ip>:8080/”
Environment=“HTTPS_PROXY=http://<ip>:8080/”
  • ~/.docker/config.json
{
   “proxies”: {
          “default”: {
          “httpProxy”: “http://<ip>:8080”,
            “httpsProxy”: “http://<ip>:8080”
         }
    }
}
  • sudo systemctl edit docker
[Service]
Environment=“HTTP_PROXY=http://<ip>:8080/”
Environment=“HTTPS_PROXY=http://<ip>:8080/”

Note::

  • My observation in mac, application using the docker desktop level proxy, if set container level it’s not taking it
  • In Linux container level and docker level both not working

Could you please help me on the same issue…!

OS Version

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

Followed below link for installation
Link

Maybe there is something I don’t know, so help me, how should this URL work? What proxy should it use?

http://:8080/

While formating i missed to add IP, i’m using like

http://<ip>:8080

If the problem is in the container, try runnint the env command in the container and make sure you have HTTP_PROXY, http_proxy, HTTPS_PROXY and https_proxy set.

env | grep -i proxy

In you docker command you have only the lowercase versions. Some programs support only the lowercse or upparcase. This is why Docker sets both when you configure it in the json, but if anything goes wrong and the variables are not all set, the some app may fail to use the proxy. If all variables exist, then the app itself could be the one that does not support those variables.

Output:

 env | grep -i prox
https_proxy=http://<ip>:8080
HTTPS_PROXY=http://<ip>:8080
HTTP_PROXY=http://<ip>:8080
http_proxy=http://<ip>:8080

And what is the application? I really don’t see other reason than the application does not use these variables. What kind of application is it? Python, Java, anything else?