On macOS, Docker Desktop mounts all paths as private (rprivate) in its
Linux VM via VirtioFS, so rslave/rshared bind propagation is rejected.
Strip these propagation options from the generated docker create command
when running on Darwin.
Also fix a bug in distrobox-init where the socket path prefix stripping
used `sed 's|/run/host||g'` with the global flag, causing paths like
`/run/host/run/host-services/ssh-auth.sock` (a Docker Desktop socket)
to be mangled into `-services/ssh-auth.sock`. The leading `-` was then
parsed as a flag by `rm`, crashing the init script. Replace with shell
parameter expansion `${host_socket#/run/host}` which strips the prefix
exactly once.
distrobox-init detects "rootful" mode by checking if /run/host/etc/shadow
is accessible and owned by root. On macOS with Docker Desktop, all containers
run as root inside the Linux VM, so this check always succeeds even for
containers created without --root, causing a spurious first-shell password
prompt.
Fix this by having distrobox-create mount /dev/null:/run/.distrobox.rootless:ro
for every rootless container. distrobox-init now checks for this marker first
and skips the shadow heuristic when it is present.
This is backward-compatible: existing containers without the marker continue
to use the shadow-file heuristic as before.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
When podman runs a container that prints stdout with no input, this is
appended to the return of the generate_create_command output, resulting
in an invalid command
Currently distrobox will reserve all subuids/subgids available.
This has the unfortunate effect of blocking other containers from running
that require their own set of subuids/subgids.
podman has added a feature that lets us restrict the amount of
subuids/subgids we request. If available, set the amount to 65536 which
is the standard amount needed for a typical Linux single container.
Disable this by setting DBX_USERNS_NOLIMIT=1.
Signed-off-by: Jookia <contact@jookia.org>
Use host's hostname by default.
This will fix issues with apps not matching StartupWMClass, and other
pesky bugs.
Fix#62Fix#728Fix#994Fix#1306
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
* all: process unhandled DBX_NON_INTERACTIVE and DBX_VERBOSE env vars
DBX_NON_INTERACTIVE was added in 7203563, but has not been added to new
files since then.
DBX_VERBOSE was added in 78b3319, but was not handled in all files that
use verbose as an option.
* all: modify optional env var header to reflect script implementation
* all: fix configs not being parsed/handled in all commands
* all: general code organization for consistency/readability
* fix: revert changes for in-container commands
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
---------
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: Luca Di Maio <luca.dimaio1@gmail.com>
* Add --hostname argument and DBX_CONTAINER_HOSTNAME env var
* Update usage/distrobox-create.md and useful_tips.md
* Refining error message when hostname is too long
* Add host terminfo separately and add it as fallback
This should allow the user to use a modern terminal without installing anything
additional inside the container itself
* Remove unecessary volume mount