Running host programs in isolation inside one-off Docker containers
February 17, 2017
I am quite bad at remembering how to launch docker to have everything set up correctly. Hence the following - a script that launches any commandline specified in its arguments inside a new docker container. Current directory is mounted inside the container automatically, so the thing you are executing can have its local dependencies satisfied.
#!/bin/bash
USERNAME=
MOUNT_PATH="/mnt"
CURRENT_DIRECTORY=IMAGE="debian:jessie"
if ; then
fi
RESOLVED_ARGUMENTS=""
# restore SELinux context for the current directory
restorecon_path=
if ; then
fi
I use vanilla Debian Jessie as a run platform there, mostly because this is what most of my servers run.
The script covers setting up SELinux and mounting the directory from which it is run as /mnt inside the container while also having the default non-root user added.
Run Jessie, run !