toolbox/doc/toolbox-init-container.1.md
Debarshi Ray 58638c5940 Deprecate the --monitor-host option of 'init-container'
The --monitor-host option was added to the 'init-container' command in
commit 8b84b5e460 to accommodate Podman versions older than 1.2.0
that didn't have the '--dns none' and '--no-hosts' options for
'podman create'.  These options are necessary to keep the Toolbx
container's /etc/resolv.conf and /etc/hosts files synchronized with
those of the host.

Note that Podman 1.2.0 was already available a few months before
commit 8b84b5e460 introduced the --monitor-host option.  The
chances of someone using an older Podman back then was already on the
decline, and it's very unlikely that a container created with such a
Podman has survived till this date.

Commit b6b484fa79 raised the minimum required Podman version to
1.4.0, and made the '--dns none' and '--no-hosts' options a hard
requirement.  The minimum required Podman version was again raised
recently in commit 8e80dd5db1 to 1.6.4.  Therefore, these days,
there's no need to separately use the --monitor-host option of
'init-container' for newly created containers to indicate that the
Podman version wasn't older than 1.2.0.

Given all this, it's time to stop using the --monitor-host option of
'init-container', and assume that it's always set.  The option is still
accepted to retain compatibility with existing Toolbx containers.

For containers that were created with the --monitor-host option, a
deprecation notice will be shown as:
  $ podman start --attach CONTAINER
  Flag --monitor-host has been deprecated, it does nothing
  ...

https://github.com/containers/toolbox/pull/617
2023-03-07 15:39:57 +01:00

3.3 KiB

% toolbox-init-container 1

NAME

toolbox-init-container - Initialize a running container

SYNOPSIS

toolbox init-container --gid GID --home HOME --home-link --media-link --mnt-link --shell SHELL --uid UID --user USER

DESCRIPTION

Initializes a newly created container that's running. It is primarily meant to be used as the entry point for all toolbox containers, and must be run inside the container that's to be initialized. It is not expected to be directly invoked by humans, and cannot be used on the host.

A key feature of toolbox containers is their entry point, the toolbox init-container command.

OCI containers are inherently immutable. Configuration options passed through podman create are baked into the definition of the OCI container, and can't be changed later. This means that changes and improvements made in newer versions of Toolbox can't be applied to pre-existing toolbox containers created by older versions of Toolbox. This is avoided by using the entry point to configure the container at runtime.

The entry point of a toolbox container customizes the container to fit the current user by ensuring that it has a user that matches the one on the host, and grants it sudo and root access.

Crucial configuration files, such as /etc/host.conf, /etc/hosts, /etc/localtime, /etc/resolv.conf and /etc/timezone, inside the container are kept synchronized with the host. The entry point also bind mounts various subsets of the host's file system hierarchy to their corresponding locations inside the container to provide seamless integration with the host. This includes /run/libvirt, /run/systemd/journal, /run/udev/data, /var/lib/libvirt, /var/lib/systemd/coredump, /var/log/journal and others.

On some host operating systems, important paths like /home, /media or /mnt are symbolic links to other locations. The entry point ensures that paths inside the container match those on the host, to avoid needless confusion.

OPTIONS

The following options are understood:

--gid GID

Pass GID as the user's numerical group ID from the host to the toolbox container.

--home HOME

Create a user inside the toolbox container whose login directory is HOME. This option is required.

--home-link

Make /home a symbolic link to /var/home.

--media-link

Make /media a symbolic link to /run/media.

--mnt-link

Make /mnt a symbolic link to /var/mnt.

--monitor-host

Deprecated, does nothing.

Crucial configuration files inside the toolbox container are always kept synchronized with their counterparts on the host, and various subsets of the host's file system hierarchy are always bind mounted to their corresponding locations inside the toolbox container.

--shell SHELL

Create a user inside the toolbox container whose login shell is SHELL. This option is required.

--uid UID

Create a user inside the toolbox container whose numerical user ID is UID. This option is required.

--user USER

Create a user inside the toolbox container whose login name is LOGIN. This option is required.

SEE ALSO

toolbox(1), podman(1), podman-create(1), podman-start(1)