Skip to content

Docker rootless support #311

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

Merged
merged 4 commits into from
Mar 13, 2022

Conversation

pathros
Copy link
Contributor

@pathros pathros commented Jul 14, 2021

I added support for Docker Rootless.

This has been possible by adding the possibility to bind the docker.sock to the user's current $XDG_RUNTIME_DIR, which is found in the user's .bashrc file, that he added after installing docker rootless, by following the instructions from the official documentation (https://docs.docker.com/engine/security/rootless/) to run the Docker Daemon as a non-root user.

I have tested this already on an Ubuntu 20.04.2 VPS where I set up Docker rootless according to the Docker rootless official documentation.

pathros added 3 commits July 14, 2021 16:32
This has been possible by adding the possibility to bind the docker.sock to the user's current $XDG_RUNTIME_DIR, which is found in the user's .bashrc file, that he added after installing docker rootless, by following the instructions from the official documentation (https://docs.docker.com/engine/security/rootless/) to run the Docker Daemon as a non-root user.

To achieve this, I made the following changes:
1) I added the DOCKER_HOST_ROOTLESS_PATH= variable inside the .env.sample file.
2) I updated in the two required lines of the docker-compose.yml file, the following: ${DOCKER_HOST_ROOTLESS_PATH:-/var/run/docker.sock}  , instead of /var/run/docker.sock:/tmp/docker.sock:ro, so that this fixes the "Error: you need to share your Docker host socket with a volume at /var/run/docker.sock. Typically you should run your container with: '-v /var/run/docker.sock:/var/run/docker.sock:ro'" error when using docker rootless.
3) I attempted to update the MD5 of both the .env.sample & docker-compose.yml file [PLEASE CHECK]
4) I updated the usage text in the usage-fresh-start.sh file, so that the user can notice this optional flag: either "-dr" or "--docker-rootless"
5) I updated the update-env-new-site-variables.sh to update the .env DOCKER_HOST_ROOTLESS_PATH to set the user's current $XDG_RUNTIME_DIR, in case the "-dr" flag has been specified. Otherwise, this is left blank and no further action is done.
6) I updated the fresh-start.sh file to take into account the "-dr" flag.

Shouldn't the "-dr" flag be specified, the programme should continue normally.
@evertramos
Copy link
Owner

I will need to test it in order to merge this PR and might take a while on that. but thanks in advance.

@evertramos evertramos merged commit 2875ea3 into evertramos:master Mar 13, 2022
@evertramos
Copy link
Owner

Kind of late but could update the other related scripts into this PR. thanks again! nice job!!

@bjorn
Copy link

bjorn commented Mar 16, 2022

While trying to set up the latest version on a standard DigitalOcean docker-compose image, I was running into the following error when running fresh-start.sh:

✘ ERROR   You must inform the required argument(s) to the function: 'env_update_variable' 
   Replace string: DOCKER_HOST_ROOTLESS_PATH

Not knowing how to resolve that, I was able to get things set up by checking out the v0.6 tag first. So, possibly the instructions need some kind of update after this change?

@pathros
Copy link
Contributor Author

pathros commented Mar 16, 2022

Also try running the help flag, so you can see all options available, and some explanation:

$ ./fresh-start.sh --help

@bjorn
Copy link

bjorn commented Mar 16, 2022

@pathros I was just trying to get this proxy to work by following its instructions. I think there may be a bug in this PR in that if there is no DOCKER_HOST_ROOTLESS_PATH value given, it errors out instead of just not using Docker Rootless, as written in the .env.sample.

@evertramos
Copy link
Owner

evertramos commented Mar 17, 2022

@bjorn

You were right, there was a bug reported in a related repo:

evertramos/easy-server#1

We miss the optional update script when updating the env variable, I just fixed that. So please try again without the rootless option:

3953465

Would you mind to try again and give us a feedback?

Thanks you very much for bringing this up.

@bjorn
Copy link

bjorn commented Mar 17, 2022

Would you mind to try again and give us a feedback?

Well, I got my proxy working with v0.6 and don't really want to run the setup script again for now. The fix looks good though, thanks!

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

Successfully merging this pull request may close these issues.

3 participants