Ceedling docker container should not use root as default user #990
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was some discussion in another issue about how to run Ceedling using docker containers and it was advised to use the root user. I am not certain how container was done as there's no
Dockerfile
in this repo, but we should not promote usage of root user inside the docker container, especially since artifacts created by docker container are used by host user (uploaded, debugging,etc).Solution is to create a user inside the docker container (lets say developer - command is USER) and use that (I think installation of gem will also need to be done as that user. Then the build directory will not be owned by root (uid 1) but by that user (uid:1000) which in most cases is also an initial user of host system. That way files created within docker container have uid and gid 1000 and not 1 as they do with root and user can delete them without using docker container cleanup (
ceedling clobber
orceedling clean
).The usage of
--user
command is a bit of a bypass. It uses root user inside the docker container, but that is mapped as current user and group on host. I have added that part to the README (as I could contribute), to at least a bit educate the people. The command is only tested on Linux, but I also amended the line for Z-shell, which I did not test.