Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debootstrap inside a docker container

Tags:

Here's my problem: I want to build a chroot environment inside a docker container. The problem is that debootstrap cannot run, because it cannot mount proc in the chroot:

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

(in the log the problem turns out to be: mount: permission denied)

If I run --privileged the container, it (of course) works... I'd really really really like to debootstrap the chroot in the Dockerfile (much much cleaner). Is there a way I can get it to work?

Thanks a lot!

like image 370
fbrusch Avatar asked Oct 16 '14 13:10

fbrusch


People also ask

Can you work inside a docker container?

Once you have your Docker container up and running, you can work with the environment of the Docker container in the same way you would do with an Ubuntu machine. You can access the bash or shell of the container and execute commands inside it and play around with the file system.

How do I put something inside a docker container?

To install packages in a docker container, the packages should be defined in the Dockerfile. If you want to install packages in the Container, use the RUN statement followed by exact download command . You can update the Dockerfile with latest list of packages at anytime and build again to create new image out of it.

What happens when you press Ctrl P Q inside the container in Docker?

To detach from a running container, use ^P^Q (hold Ctrl , press P , press Q , release Ctrl ).

What does -- RM do in Docker?

The --rm causes Docker to automatically remove the container when it exits. The image being used to create the container is generally specified as <name>:<tag> such as ruby:latest . If the specified image is not available locally, Docker will attempt to retrieve it from Docker Hub (or any connected Docker registry).


1 Answers

You could use the fakechroot variant of debootstrap, like this:

fakechroot fakeroot debootstrap --variant=fakechroot ... 

Cheers!

like image 109
Luis Alejandro Avatar answered Sep 29 '22 04:09

Luis Alejandro