Skip to content

Commit

Permalink
Merge pull request #102725 from thefloweringash/dockertools-proc
Browse files Browse the repository at this point in the history
dockerTools: fix absent /proc during runAsRoot
  • Loading branch information
Mic92 committed Apr 12, 2021
2 parents 56d3864 + 5b82b8d commit 65a40ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkgs/build-support/docker/default.nix
Expand Up @@ -418,7 +418,11 @@ rec {
# details on what's going on here; basically this command
# means that the runAsRootScript will be executed in a nearly
# completely isolated environment.
unshare -imnpuf --mount-proc chroot mnt ${runAsRootScript}
#
# Ideally we would use --mount-proc=mnt/proc or similar, but this
# doesn't work. The workaround is to setup proc after unshare.
# See: https://github.com/karelzak/util-linux/issues/648
unshare -imnpuf --mount-proc sh -c 'mount --rbind /proc mnt/proc && chroot mnt ${runAsRootScript}'
# Unmount directories and remove them.
umount -R mnt/dev mnt/sys mnt${storeDir}
Expand Down

0 comments on commit 65a40ca

Please sign in to comment.