Deprecate the --monitor-host option of 'init-container'
The --monitor-host option was added to the 'init-container' command in commit8b84b5e460
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 commit8b84b5e460
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. Commitb6b484fa79
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 commit8e80dd5db1
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
This commit is contained in:
parent
9680e4eeb2
commit
58638c5940
3 changed files with 52 additions and 73 deletions
|
@ -9,7 +9,6 @@ toolbox\-init\-container - Initialize a running container
|
|||
*--home-link*
|
||||
*--media-link*
|
||||
*--mnt-link*
|
||||
*--monitor-host*
|
||||
*--shell SHELL*
|
||||
*--uid UID*
|
||||
*--user USER*
|
||||
|
@ -76,31 +75,12 @@ Make `/mnt` a symbolic link to `/var/mnt`.
|
|||
|
||||
**--monitor-host**
|
||||
|
||||
Ensures that certain configuration files inside the toolbox container are kept
|
||||
synchronized with their counterparts on the host, and bind mounts some paths
|
||||
from the host's file system into the container.
|
||||
Deprecated, does nothing.
|
||||
|
||||
The synchronized files are:
|
||||
|
||||
- `/etc/host.conf`
|
||||
- `/etc/hosts`
|
||||
- `/etc/localtime`
|
||||
- `/etc/resolv.conf`
|
||||
- `/etc/timezone`
|
||||
|
||||
The bind mounted paths are:
|
||||
|
||||
- `/etc/machine-id`
|
||||
- `/run/libvirt`
|
||||
- `/run/systemd/journal`
|
||||
- `/run/systemd/resolve`
|
||||
- `/run/udev/data`
|
||||
- `/tmp`
|
||||
- `/var/lib/flatpak`
|
||||
- `/var/lib/libvirt`
|
||||
- `/var/lib/systemd/coredump`
|
||||
- `/var/log/journal`
|
||||
- `/var/mnt`
|
||||
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
|
||||
|
||||
|
|
|
@ -386,7 +386,6 @@ func createContainer(container, image, release, authFile string, showCommandToEn
|
|||
"--shell", userShell,
|
||||
"--uid", currentUser.Uid,
|
||||
"--user", currentUser.Username,
|
||||
"--monitor-host",
|
||||
}
|
||||
|
||||
entryPoint = append(entryPoint, slashHomeLink...)
|
||||
|
|
|
@ -107,8 +107,12 @@ func init() {
|
|||
|
||||
flags.BoolVar(&initContainerFlags.monitorHost,
|
||||
"monitor-host",
|
||||
false,
|
||||
"Ensure that certain configuration files inside the toolbox container are in sync with the host")
|
||||
true,
|
||||
"Deprecated, does nothing")
|
||||
if err := flags.MarkDeprecated("monitor-host", "it does nothing"); err != nil {
|
||||
panicMsg := fmt.Sprintf("cannot mark --monitor-host as deprecated: %s", err)
|
||||
panic(panicMsg)
|
||||
}
|
||||
|
||||
flags.StringVar(&initContainerFlags.shell,
|
||||
"shell",
|
||||
|
@ -163,9 +167,6 @@ func initContainer(cmd *cobra.Command, args []string) error {
|
|||
|
||||
defer toolboxEnvFile.Close()
|
||||
|
||||
if initContainerFlags.monitorHost {
|
||||
logrus.Debug("Monitoring host")
|
||||
|
||||
if utils.PathExists("/run/host/etc") {
|
||||
logrus.Debug("Path /run/host/etc exists")
|
||||
|
||||
|
@ -218,7 +219,6 @@ func initContainer(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if initContainerFlags.mediaLink {
|
||||
if _, err := os.Readlink("/media"); err != nil {
|
||||
|
|
Loading…
Reference in a new issue