Requirements:
- Linux
- A linux filesystem if you wish to containerize to a linux environment. You can get one from Alpine Linux
Usage:
How to open a ash window, which is like bash (Alpine linux fs)
gontainer -chrt "/home/alpine-fs" run ash Example on how to run python (must be installed beforehand, see Gockerfile)
gontainer -chrt "/home/alpine-fs" run python3 Requirements:
- Gontainer binary
mnt-vfs.shshell script- Linux filesystem image (alpine available at Alpine Linux)
- Root privilidges for all commands
-
Create a blank virtual file system and mount using the
mnt-vfs.shscript.cd /dev/external-hard-drive sudo mnt-vfs.sh VFS 200This command will create a directory for the VFS at
/mnt/VFSand create a blank image for the filesystem of typeext3in the working directory calledVFS.ext3. The size of the image will be 200MB, trying to store more than that on the filesystem will be impossible. Finally it mounts the newly createdVFS.ext3filesystem image to/mnt/VFSso that the filesystem is ready to use. It also adds an mounting line to/etc/fstabfile so that when mounting the filesystem correct parameters are used. -
Copy linux filesystem image to newly created VFS. For this example the filesystem is located at
$HOME/alpine-fs.sudo cp -r $HOME/alpine-fs/* /mnt/VFS/
Check if copy was succesfull:
# ls /mnt/upsya-vfs alpine-fs bin dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var -
You may now use gontainer on the image. Open a shell with
ashsudo gontainer -chrt /mnt/my-vfs run sh
Look at the
Gockerfilefor typical first commands on getting a python installation up and running.
To uninstall virtual filesystem delete the line in your /etc/fstab folder corresponding
to the virtual filesystem (only one line with second value set to mount directory).
Finally delete the mount directory.