Debootstrap inside docker container

Here is my problem: I want to build a chroot environment inside a docker container. The problem is that debootstrap cannot work because it cannot connect proc in chroot:

W: Failure trying to run: chroot /var/chroot mount -t proc proc /proc

(in the log the problem is: mount: permission denied )

If I run --privileged container, it (of course) works ... I really really would like to cancel the chroot in the Dockerfile (much cleaner). Is there any way to make it work?

Thank you so much!

+7
docker chroot
source share
4 answers

No, this is currently not possible.

Issue No. 1916 (regarding launching privileged operations during docker build ) remains an open issue. In one place, there was the addition of a command line flag and a RUNP , but none of them were implemented.

+3
source share

You can use the fakechroot debootstrap option, for example:

 fakechroot fakeroot debootstrap --variant=fakechroot ... 

Hooray!

+1
source share

Short answer, without privileged mode there is no way.

Docker is aimed at microservices and is not a replacement for virtual machines. Having multiple installations in one container is definitely not the case. Why not use multiple docker containers?

0
source share

Adding --cap-add=SYS_ADMIN --security-opt apparmor:unconfined to the docker run works for me.

See mobility / mobility issue 16429

0
source share

All Articles