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

Support for docker-socket-proxy #287

Closed
thielj opened this issue Apr 19, 2024 · 4 comments
Closed

Support for docker-socket-proxy #287

thielj opened this issue Apr 19, 2024 · 4 comments

Comments

@thielj
Copy link

thielj commented Apr 19, 2024

Hi,

can you add support for controlling docker through a network proxy, instead of requiring direct access to the socket, please? Similar to what setting DOCKER_HOST or using docker -H <endpoint> would do.

For example, through a configuration setting like this:

    endpoint: "unix:///var/run/docker.sock"     # Default, listen to the UNIX Docker socket
    #endpoint: "tcp://docker-socket-proxy:2375"   # Use a network proxy instead

Ideally, this would be configurable per service or middleware, which would allow managing a containers on different hosts.

See https://github.com/Tecnativa/docker-socket-proxy and https://flast101.github.io/docker-privesc/ for some background info.

@thielj
Copy link
Author

thielj commented Apr 19, 2024

Actually, I just checked if the docker client library you're using might support this already And yes, it does :) Just set set an environment variable like DOCKER_HOST: 'tcp://docker-socket-proxy:2375'.

Maybe worth mentioning in the docs?

https://pkg.go.dev/github.com/docker/docker/client#EnvOverrideHost

@acouvreur
Copy link
Owner

Hello!

Yes the library is configured to support all environnement variables.
Yes we could add it to the docs!

@Sblop
Copy link

Sblop commented May 31, 2024

Hi. While this works, the sablier container now runs at 100% CPU. Logs doesnt assist.

Sblop added a commit to Sblop/sablier that referenced this issue Jun 4, 2024
This change addresses the issue reported in Issue acouvreur#287, where the CPU load reaches 100% when the DOCKER_HOST environment variable is set to a value other than the default /var/run/docker.sock. The infinite loop in the NotifyInstanceStopped method was causing excessive CPU usage due to continuous polling without any delay. Introducing a small delay (100 milliseconds) in the loop reduces CPU load while maintaining functionality. 
This modification ensures that the event loop does not consume excessive CPU resources, especially when connected to a remote Docker host.
@acouvreur
Copy link
Owner

Closing this in favor of #272

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