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

function docker_api : Using protected socket #754

Open
arnaudschaeffer opened this issue Feb 11, 2021 · 1 comment
Open

function docker_api : Using protected socket #754

arnaudschaeffer opened this issue Feb 11, 2021 · 1 comment
Assignees
Labels
kind/feature-request Issue requesting a new feature

Comments

@arnaudschaeffer
Copy link

Hello,

I configured docker to protect the docker daemon socket and make it available through HTTPS. I follow the Docker documentation to this (Protect the Docker daemon socket).

I use the official nginx image for the reverse proxy and jwilder/docker-gen which required access to the docker daemon socket.

By setting the following environment variables, the image jwilder/docker-gen works without mounting the docker daemon socket.

DOCKER_OPTS=--key /home/.docker/key.pem --cacert /home/.docker/ca.pem --cert /home/.docker/cert.pem
# in my case 172.18.0.1 is the Gateway IP
DOCKER_HOST=tcp://172.18.0.1:2376

Is there a way to do this with this image ?

I manage to make it work by editing the docker_api in functions.sh. The modification I made are not generic, so I can't do a PR. But I might give it a shot if it's something missing.

@buchdag buchdag self-assigned this Feb 19, 2021
arnaudschaeffer added a commit to arnaudschaeffer/docker-letsencrypt-nginx-proxy-companion that referenced this issue Mar 15, 2021
arnaudschaeffer added a commit to arnaudschaeffer/docker-letsencrypt-nginx-proxy-companion that referenced this issue Mar 15, 2021
@arnaudschaeffer
Copy link
Author

Hi there,

I did some modifications to use this image with a protected docker daemon socket and without running the image as root.

The code I pushed is working for what I want to accomplish, but it's not good enough for a pull request.

In order to access the socket with https, you should add the following in your environment variables :

# Url of the docker socket
DOCKER_HOST=tcp://172.18.0.1:2376
# path where key.pem, ca.pem and cert.pem are located
DOCKER_CERT_PATH=/home/ubuntu/.docker

I had lot of troubles when I wanted not to run this image as root. I've ended up installing acme.sh with the user starting the docker container and mounting this volume and commenting so lines in the check_writable_directory function. Then, I set the acme path to an environment variable :

ACMESH_PATH=/home/user/.acme.sh

So this might be use as a starting point for this issue. If someone wants to give me pointer to fix the problem, I would be glad to try to do something better !

@buchdag buchdag added the kind/feature-request Issue requesting a new feature label Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request Issue requesting a new feature
Projects
None yet
Development

No branches or pull requests

2 participants