You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
6.6 KiB

RUNON - Run your commands in any systems
(c) 2021 Gilles Grandou <>
licensed under GPL-2.0.
$ grep ^PRETTY_NAME /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
$ runon centos7 grep ^PRETTY_NAME /etc/os-release
PRETTY_NAME="CentOS Linux 7 (Core)"
$ runon ubuntu20.04 grep ^PRETTY_NAME /etc/os-release
PRETTY_NAME="Ubuntu 20.04.2 LTS"
$ runon debian9 grep ^PRETTY_NAME /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
$ runon centos7 xclock
[xclock launched!]
Installation has been tested on:
* Debian 10 (buster)
* Ubuntu 20.04 (Focal)
However it should work straightforward on any equivalent system.
### Docker Install
sudo apt install docker
sudo systemctl enable --now docker
Check that your are member of `docker` group:
sudo adduser <user> docker
If needed, you need to logout and login again for the new group to
become active.
### Python Dependencies
sudo apt install python3-docker python3-dockerpty python3-xdg
### manual install
cd <tools>
git clone
local install, in your `~/local/bin` (or wherever directory which is in your
cd <runon>
./install local
./install local <your_bin_path>
system install, for all users:
cd <runon>
sudo ./install system
each user can have its own configuration in `~/.config/runon/runon.conf`
if needed.
### uninstall
simply pass `-u` to install command you have used, eg.:
./install local -u
./install local -u <dir>
sudo ./install system -u
### some convenient links
you can create soft links to `runos` to simplify calls:
runos centos7 -l
now calling `centos7 ...` is equivalent to call `runos centos7 ...`:
centos7 xclock
With the default configuration, a seamless environment is set up,
allowing to transparently run commands in various environments, while
* user environment (uid, gid, password, home directory, ...)
* X support to run graphical applications
### Basic usage
runon [options] <osname> <command>
runon -h
### available options
* `-v` verbose output, this is really usefull when running new
containers for the first time, as the initial docker build can be
quite long (several minutes) especially with slow internet link.
If the command seems to be stalled, don't hesitate to interrupt it
(with `CTRL-C`) and to restart it with `-v`.
* `-u` forces the container image to be updated, useful if the
distribution has been updated and you want to use it. Otherwise,
if a container has been already built, it will be used directly
without doing any network access.
* `-c <configfile>` uses a custom config file, useful to try new
distribution without breaking your running config.
### Interactive shell
Just run:
runon <osname>
while start an insteractive shell in the container system:
gilles@host:~$ runon centos8
(centos8) gilles@host:~$ cat /etc/os-release
NAME="CentOS Linux"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 8"
(centos8) gilles@host:~$ id
uid=1000(gilles) gid=1000(gilles) groups=1000(gilles)
(centos8) gilles@host:~$ sudo id
[sudo] password for gilles:
uid=0(root) gid=0(root) groups=0(root)
(centos8) gilles@host:~$ xclock
(centos8) gilles@host:~$ exit
Configuration is done in `runon.conf` file, which describes supported
distribution in .INI format.
### Example config
environment =
binds =
dockerfile =
FROM centos:8
RUN yum install dnf-plugins-core -y
RUN yum config-manager --set-enabled powertools -y
RUN yum install sudo -y
RUN echo "Defaults lecture = never" >> /etc/sudoers
RUN echo "ALL ALL=(ALL) ALL" >> /etc/sudoers
pkginstall = RUN yum install {} -y
packages = ksh csh xterm xorg-x11-apps xkeyboard-config git
dockerfile =
FROM debian:9
RUN apt-get update
RUN apt-get -y install sudo
RUN echo "Defaults lecture = never" >> /etc/sudoers
pkginstall = RUN apt-get -y install {}
packages = ksh csh xterm x11-apps libgtk-3-0 build-essential git
Each section `[osname]` defines a distribution which can be used by runon.
The `[DEFAULT]` section defines default values which is used if not
overriden in individual section.
### Config entries
* `dockerfile` the base content of dockerfile which will be used to
generate the running environment. There is usually no need to diverge
from the ones given in example.
* `pkginstall` the dockerfile command used to install a package, likely
to be standard for all `deb` and `rpm` based distributions. In the
command `{}` is replaced by the package name.
* `packages` the list of packages to install. Feel free to add the ones
you need for your commands (likely news system libs, new tools, ...)
* `binds` the list of files and directories from the host system to
expose in the container system. you might want to add `/opt` or other
shared directories. See below for a description of `binds` entries
* `environment` the list of environment variables you want to pass or
set in the container system. See below for a description
Lines starting with `#` or `;` are comments.
Some substitution happens upon reading the configuration:
* `${user}` the current username
* `${osname}` the executed distribution.
### Binds
Each `binds` line can have one of the following formats:
* `<hostpath>` is the filename or the dirname of the path you want
to expose
* `<containerpath>` is the pathname inside the container, by default
it's the same path.
* `<mode>` can be `rw`, read-write (by default), or `ro`, read-only.
### Environment
Each `environment` line define a Environment Variable which is set
in the container upon execution.
Each line can have one of the following formats:
If no value is given, the host value is passed into the container.