Created
December 14, 2018 13:11
-
-
Save jdmichaud/1bf8d036eebf88768823365bf923ac10 to your computer and use it in GitHub Desktop.
Creates a linux virtual environment in .env (using overlayfs and chroot)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
mkdir .env | |
mkdir .env/{upper,work,mount} | |
sudo mount -t overlay -o lowerdir=/,upperdir=.env/upper,workdir=.env/work overlayfs .env/mount | |
sudo mount -t proc proc .env/mount/proc | |
sudo mount -t sysfs sys .env/mount/sys | |
sudo mount -t devtmpfs dev .env/mount/dev | |
# Needed for tty | |
sudo mount --bind /dev/pts .env/mount/dev/pts | |
# Needed for networking (/etc/resolv.conf is pointing to /run) | |
sudo mount --bind /run .env/mount/run | |
sudo env HOME=/home/$USER chroot --userspec=$USER:$GROUPS env/mount /bin/bash --login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment