Files
distrobox/docs/usage/distrobox-enter.md
T

88 lines
3.2 KiB
Markdown
Raw Normal View History

2022-06-22 08:47:30 +02:00
<!-- markdownlint-disable MD010 MD036 -->
# NAME
distrobox enter
distrobox-enter
# DESCRIPTION
2022-01-13 19:23:12 +01:00
distrobox-enter takes care of entering the container with the name specified.
Default command executed is your SHELL, but you can specify different shells or
entire commands to execute.
If using it inside a script, an application, or a service, you can specify the
--headless mode to disable tty and interactivity.
2022-06-22 08:47:30 +02:00
# SYNOPSIS
**distrobox enter**
--name/-n: name for the distrobox default: my-distrobox
2024-02-22 00:07:53 +01:00
--/-e: end arguments execute the rest as command to execute at login default: default ${USER}'s shell
2022-06-22 08:47:30 +02:00
--no-tty/-T: do not instantiate a tty
2023-06-17 09:02:18 +02:00
--no-workdir/-nw: always start the container from container's home directory
2022-06-22 08:47:30 +02:00
--additional-flags/-a: additional flags to pass to the container manager command
--help/-h: show this message
2023-09-15 10:58:15 +02:00
--root/-r: launch podman/docker/lilipod with root privileges. Note that if you need root this is the preferred
way over "sudo distrobox" (note: if using a program other than 'sudo' for root privileges is necessary,
specify it through the DBX_SUDO_PROGRAM env variable, or 'distrobox_sudo_program' config variable)
2022-06-22 08:47:30 +02:00
--dry-run/-d: only print the container manager command generated
--verbose/-v: show more verbosity
--version/-V: show version
# EXAMPLES
2022-01-13 19:23:12 +01:00
2023-03-29 09:00:21 +02:00
Enter a distrobox named "example"
2023-04-06 23:21:15 +02:00
distrobox-enter example
2023-03-29 09:00:21 +02:00
Enter a distrobox specifying a command
2022-01-13 19:23:12 +01:00
distrobox-enter --name fedora-toolbox-35 -- bash -l
distrobox-enter my-alpine-container -- sh -l
2023-03-29 09:00:21 +02:00
2023-09-15 10:58:15 +02:00
Use additional podman/docker/lilipod flags while entering a distrobox
2023-03-29 09:00:21 +02:00
distrobox-enter --additional-flags "--preserve-fds" --name test -- bash -l
2023-03-29 09:00:21 +02:00
Specify additional environment variables while entering a distrobox
distrobox-enter --additional-flags "--env MY_VAR=value" --name test -- bash -l
MY_VAR=value distrobox-enter --additional-flags "--preserve-fds" --name test -- bash -l
2022-01-13 19:23:12 +01:00
You can also use environment variables to specify container manager and container name:
DBX_CONTAINER_MANAGER="docker" DBX_CONTAINER_NAME=test-alpine distrobox-enter
2023-03-29 09:00:21 +02:00
# ENVIRONMENT VARIABLES
2022-01-13 19:43:14 +01:00
DBX_CONTAINER_NAME
DBX_CONTAINER_MANAGER
DBX_SKIP_WORKDIR
DBX_SUDO_PROGRAM
2022-01-13 19:43:14 +01:00
2023-03-29 09:00:21 +02:00
# EXTRA
This command is used to enter the distrobox itself. Personally, I just create multiple profiles in
2022-04-05 18:21:37 +02:00
my `gnome-terminal` to have multiple distros accessible.
The `--additional-flags` or `-a` is useful to modify default command when executing in the container.
For example:
distrobox enter -n dev-arch --additional-flags "--env my_var=test" -- printenv &| grep my_var
my_var=test
This is possible also using normal env variables:
my_var=test distrobox enter -n dev-arch --additional-flags -- printenv &| grep my_var
my_var=test
If you'd like to enter a rootful container having distrobox use a program other than 'sudo' to
2023-09-15 10:58:15 +02:00
run podman/docker/lilipod as root, such as 'pkexec' or 'doas', you may specify it with the
`DBX_SUDO_PROGRAM` environment variable. For example, to use 'doas' to enter a rootful container:
DBX_SUDO_PROGRAM="doas" distrobox enter -n container --root
Additionally, in one of the config file paths that distrobox supports, such as `~/.distroboxrc`,
you can also append the line `distrobox_sudo_program="doas"` (for example) to always run
distrobox commands involving rootful containers using 'doas'.