This commit will create a first `enter` setup for container user, in
case of rootful containers. The default behavious of passwordless
sudo/su is acceptable for rootless containers, where there is no real
privilege escalation, but is a real concern for rootful containers.
This setup will also respect host's sudoers configuration.
Root account will be locked by default in this modality.
During creation there is a really long and difficult flag that will
rever to the old behaviour, **this is highly discouraged!**
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* Add init and pre-init hook defaults as supported config options.
* Add config variables to example snippet in README.
* Allow just the name of the pre-init hook script as the option without the --pre-init-hook prefix.
* Fix a typo in the bashate CONTRIBUTING guide.
* CI: update to checkout@v3
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: Alexander, Michael <michael.alexander@karlstorz.com>
Co-authored-by: Luca Di Maio <luca.dimaio1@gmail.com>
* Fix compatibility with init containers
Fix#215
Right now systemd integration works only on docker, on podman it will
fail.
This is because docker daemon, running as root, has access to
/sys/fs/cgroup, while podman (rootless) does not.
Podman has a functionality to set up cgroups so that they work in
rootless mode as explained here: https://www.redhat.com/sysadmin/improved-systemd-podman
Right now the system is not triggered because it only checks if
entrypoint are `/sbin/init` or `/usr/bin/systemd`.
To fix this, let's force the use of systemd mode on podman if we're
using `--init`.
This problem went also undetected on the new CI as the `init` images are
tested as normal images. Let's also fix this and test create/enter on
init images using systemd commands.
* support environment variables to change defaults
* CI: test both podman and docker using new ENV variable
Implement use of environment variables to change defaults like:
- container manager
- default image to use
- default name to use
- interactivity
Variables will be respectively:
- DBX_CONTAINER_MANAGER
- DBX_CONTAINER_IMAGE
- DBX_CONTAINER_NAME
- DBX_NON_INTERACTIVE
This work opens also support for configuration rc-style files, in order of
importance:
- /usr/share/distrobox/distrobox.conf
- /etc/distrobox/distrobox.conf
- ${HOME}/.config/distrobox/distrobox.conf
- ${HOME}/.distroboxrc