Skip to content

Add a non root user (muslrust) #74

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

Closed
wants to merge 1 commit into from

Conversation

sedrik
Copy link

@sedrik sedrik commented Feb 15, 2021

This is a workaround the the (far to common) permission issues that
usually arises when using docker images as build environments. Instead
of running and building as root we now run as the muslrust user that has
been added which gets the user-id and group-id of 1000:1000 that in
many cases should also correspond to the default user for Linux users.

It might not cover all cases and therefore there is also build arguments
to configure the id of the user being created. Sadly it requires the
users of the docker image to build their own version but at least it is
doable to get around the issue.

I have intentionally not updated the docs yet as I wanted to get some feedback on this solution first. It does seem to work for my use-case and I no longer need to require sudo in my build script to change the permission of the final artifact (and building locally works as expected).

I was inspired by the last solution in this blog https://jtreminio.com/blog/running-docker-containers-as-current-host-user/

This is a workaround the the (far to common) permission issues that
usually arises when using docker images as build environments. Instead
of running and building as root we now run as the muslrust user that has
been added which gets the user-id and group-id of 1000:1000 that in
many cases should also correspond to the default user for Linux users.

It might not cover all cases and therefore there is also build arguments
to configure the id of the user being created. Sadly it requires the
users of the docker image to build their own version but at least it is
doable to get around the issue.
@clux
Copy link
Owner

clux commented Feb 16, 2021

Hey. Thank you for this. Had I done this from the beginning, I would have considered it, but at this stage it is too much of a breaking change for a docker image whose main api at this point is what tag people choose for CI. Even I have to build the image myself with this change (which goes against the point of having this on CI), so if people have to do that, they may as well fork it and build it (which they should do anyway, clux is not a trusted corporation an organisation should trust).

This was wontfixed before in #65

@clux clux closed this Feb 16, 2021
@sedrik
Copy link
Author

sedrik commented Feb 16, 2021

Thanks and I understand that reasoning.

muslrust is still probably the main reason why I will be able to put Rust in production at my company so I am very grateful for the hard work you put into it :)

@sedrik sedrik deleted the add-muslrust-user branch February 16, 2021 09:45
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.

2 participants