Skip to content

Fix permission denied errors due to root-owned directories - #27

Open
atrosinenko wants to merge 1 commit into
atrosinenko/refactor-global-varsfrom
atrosinenko/fix-permissions
Open

Fix permission denied errors due to root-owned directories#27
atrosinenko wants to merge 1 commit into
atrosinenko/refactor-global-varsfrom
atrosinenko/fix-permissions

Conversation

@atrosinenko

Copy link
Copy Markdown
Collaborator

Build inside the container is performed by the root user, who owns the produced build artifacts which are written to the host directories mounted as volumes. The most important outcome of this is that running ./build.sh host-build after the ./ccache directory was populated by an earlier containerized build results in the host-build silently disabling the build cache.

Fixing this may involve duplicating the non-privileged UID from the host to the container, so that all build artifacts are owned by the correct user from the beginning. This patch implements a simpler ad-hoc approach of using two separate cache directories: root-owned ccache-docker for containerized builds and ccache-host owned by the regular user.

Furthermore, this patch makes build.sh pre-create the top-level directories before mounting them via docker run --volume ... (assuming docker and thus the build.sh script can be run by the regular user without sudo).

Build inside the container is performed by the `root` user, who
owns the produced build artifacts which are written to the host
directories mounted as volumes. The most important outcome of
this is that running `./build.sh host-build` after the `./ccache`
directory was populated by an earlier containerized build results
in the `host-build` silently disabling the build cache.

Fixing this may involve duplicating the non-privileged UID from
the host to the container, so that all build artifacts are owned
by the correct user from the beginning. This patch implements a
simpler ad-hoc approach of using two separate cache directories:
root-owned `ccache-docker` for containerized builds and
`ccache-host` owned by the regular user.

Furthermore, this patch makes `build.sh` pre-create the top-level
directories before mounting them via `docker run --volume ...`
(assuming `docker` and thus the `build.sh` script can be run by
the regular user without `sudo`).
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.

1 participant