clux / muslrust

Docker environment for building musl based static linux rust binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The container should support running under any user

igor-petruk opened this issue · comments

For example using

$ docker run --user $(id -u)

to get binaries on host not owned by root messes up paths and so on. I wonder if we can 777 all permissions for cargo inside of the container and set up environment variables not to depend on which users runs it. In other words, $HOME should be either fixed or not matter

The current workaround is to run in case anyone wonders

docker run ... sh -c "cargo build --release && chown -R $(id -u) ./target"

I've always found that to be more trouble than it's worth. It's harder to build such an image because it screws with the entire image setup, and it doesn't fix it in all cases anyway when using volume mounts. The good solution is https://docs.docker.com/engine/security/userns-remap/ but that requires users to do things to their docker installation.

Probably not going to make this type of change at this stage tbh.