3

How can I create a mount inside a Docker container as root but without --privileged mode? The purpose is getting a chroot with /proc, and /dev mounted inside a container.

I can do so with chroot and mount commands given a container in --privileged mode, but I am looking for workarounds that do not require it.

This is for build purposes and I can accept some performance hit or other limitations.

I am looking along the lines of LD_PRELOAD, proot, pseudo, fakeroot, but had no luck so far. Is there any way?

2
  • This sounds like you might be trying to do something which could be done entirely without chroots or mounting /proc and /dev; could you give some more context? Mar 18, 2022 at 9:55
  • 1
    My environment is a Docker container provided by a CI environment which gives me no --privileged mode. Inside of that environment, I need to create a new rootfs using debootstrap, then install packages using chroot. Some packages require /proc or /dev to install successfully.
    – Lemon Sky
    Mar 18, 2022 at 10:15

1 Answer 1

0

proot worked for me in an unprivileged Docker container:

proot -w / -S /path/to/root bash

Maybe you didn't pass all of the options you needed?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .