-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Provide non-root docker build #639
Comments
How do you run |
I would like to use it in a pre-commit hook by providing a I do not quite understand why I should run the image via docker directly. How can this be automated with git hooks? |
@HendrikSchrieber You'll then probably need to figure out the way for Docker container to read-write access files on host system w/o passing host's user UID/GID to it. |
Related to #418 |
What problem are you facing?
I am trying to run pre-commit hooks using the provided docker image by using a local-repository as described here: https://pre-commit.com/#docker_image.
I have set up my docker installation to run rootless because of security concerns: https://docs.docker.com/engine/security/rootless/. Therefore, when trying to run the tflint pre-commit hook, I face the following error:
Container must run as root. Use environment variable USERID to set user.
As far as I can see, it is not possible to set environment variables when running pre-commit hooks.
How could pre-commit-terraform help solve your problem?
I believe the problem can be solved by providing a docker image build with a non-root user (default usually is 1000:1000) set. This build can be tagged with a special tag like "v1.xx.x-nonroot" or "v1.xx.x-rootless" as used by other projects. Then it would not be necessary to pass environment variables. This solution might not work in all cases, e.g. if a user has a different user id. But as 1000 is the default user id in most systems, I think it should work for most users.
The text was updated successfully, but these errors were encountered: