user
user
user
allows you to create and remove containers and associations, as well as enter shells in containers. It also happens to have a trick up its sleeve, which allows you to reproduce your system easily through a simple config file (skip to section).
Containers
Here’s how you can create a Debian container named ‘my-first-container’.
After its creation is complete, you’ll find that all of its binaries will be available on the host with the suffix .my-first-container
. For example (terminal window on the host):
- apt -> apt.my-first-container
- dpkg -> dpkg.my-first-container
- bash -> bash.my-first-container
Removing containers
Just run:
Entering containers
There are multiple ways in which you can enter a container. The first one is to use user
to enter a container, as below (terminal window on the host):
The second would be to run bash.my-first-container
in a regular shell.
Associations
You might be tired of running apt.my-first-container
all the time, in which you can shorten it to apt
by simply running the following command (terminal window on the host):
You can now install a package with sudo apt install [pkg]
from a regular shell now.
Removing associations
Just run:
Writing a configuration and importing it on other systems
Here’s what a sample configuration looks like:
Applying a configuration
Simply save the above config to a file named user.yaml
, and run user cadre [PATH TO FILE]
, where [PATH TO FILE]
is the path to user.yaml
.
If you want to understand what the above config does, read on.
Modules
Each of modules come under the modules
section in the config, and enabled
must be set to true
for each of them, as you might have noticed in the above configuration.
SSH
GNOME
Containers
Each of the containers should come under the containers
section in the config, and be in the following format:
Spot the difference between the two commands. The first one is a simple string, and is thus equivalent to:
['bash', '-c', 'echo \'This is the first command that will be run in the container after the packages are installed.\'']
The second one is in a list, and is executed directly instead of in a shell.
Associations
As with the two mentioned previously, each of the associations should come under the associations
section in the config.
Each association should be in the format: