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

Proxy env is not being applied #3922

Closed
ghost opened this issue Dec 17, 2022 · 3 comments
Closed

Proxy env is not being applied #3922

ghost opened this issue Dec 17, 2022 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 17, 2022

Description

I am trying to get my containers to use my proxy. I have tried setting the client and container variables as instructed here, also systemd as instructed here.

In all cases, even all 3 at once, the variables seem to be recognized but not applied. If the app inside allows to configure a proxy I can use mine without problems, but by default my real ip is always used. Even when I enter an invalid proxy, I still have access to the internet.

Reproduce

Follow the steps in the tutorials mentioned in the description.

Expected behavior

Connection through my proxy, or no connection at all in case I enter it correctly.

docker version

Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:58 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.12
  GitCommit:        a05d175400b1145e5e6a735a6710579d181e7fb0
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.12.2)
  scan: Docker Scan (Docker Inc., v0.21.0)

Server:
 Containers: 6
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 11
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: a05d175400b1145e5e6a735a6710579d181e7fb0
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-56-generic
 Operating System: Linux Mint 21.1
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.507GiB
 Name: user-host
 ID: 5UFO:OCAK:XYN7:L3LX:CTMZ:I4EH:ICG4:64U3:ZPGW:WYCV:QSPY:JYCT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

I should mention that I am a newbie. I've been trying to figure this out for days, but I don't rule out that I'm making a mistake because I'm missing something that is tacit.

@thaJeztah
Copy link
Member

In all cases, even all 3 at once, the variables seem to be recognized but not applied

Could you provide a bit more details? What exactly do you mean with "the variables seem to be recognised" If you run env inside a container, does it show the proxy environment variables?

@rimelek
Copy link

rimelek commented Dec 19, 2022

I leave the link here to the forum where this conversation started: How to use a proxy running on host in one container

As I wrote that there, it would be useful to know how you try to use that proxy, what is the app that needs that and ignores it. If the proxy works when you use curl or wget in the container, then maybe the app that you want to run intentionally ignores it or requires some configuration to use the proxy variables defined in the shell.

Follow the steps in the tutorials mentioned in the description.

The linked parts of the documentation don't have examples to reproduce the issue, only to set the variables. Do you have an example command like this?

docker run -it --rm -e HTTP_PROXY=http://192.168.1.2 -e HTTPS_PROXY=http://192.168.1.2 nicolaka/netshoot curl  https://docker.com

Maybe you are using the wget command or an other tool working similarly. wget uses the lowercase variables.

docker run -it --rm -e http_proxy=http://192.168.1.2 -e https_proxy=http://192.168.1.2 alpine wget -O- https://docker.com

It should be probably mentioned in the documentation to set the lowercase variables as well. Unfortunately you need to know which app uses which variables if uses it at all. As jess1239 mentioned on the forum, you could use a VPN instead of a proxy if that helps.

Without a VPN if you want to make sure no application can send request without using the proxy, you should deny all outgoing requests on the firewall and allow only the proxy server which has internet access.

@ghost
Copy link
Author

ghost commented Dec 20, 2022

Sorry, I better close this before someone else wastes their time because it's clear I was wrong, since as I said I can use the proxy if I set it up in the container app. I had a preconceived idea that applying the proxy would redirect all traffic to it.

@ghost ghost closed this as completed Dec 20, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants