Make an external folder available into a chroot environment

Recently, we were playing with a chrooted environment using mock.

We wanted  to give access to the chrooted environment to a folder that was part of the host machine but not part of its virtual environment.

To do so, we mounted the host machine folder on a new folder inside the chrooted area by executing the following on the host machine

#/var/lib/mock/fedora-25-x86_64/root/ is the root of the chrooted environment
mkdir /var/lib/mock/fedora-25-x86_64/root/cool_stuff/;
#/home/george/KickStart/cool_stuff/ is the folder which we want the chrooted environment to have access to
sudo mount --bind /home/george/KickStart/cool_stuff/ /var/lib/mock/fedora-25-x86_64/root/cool_stuff/;

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.