generate systemd: clarify limitations of `--new`
`generate systemd --new` is looking at the "create command" of the container/pod which is simply the os.Args at creation time. It does not work on containers or pods created via the REST API since the create command is not set. `--new` does work on such containers and pods since there is no reliable way to reverse-map their configs to command-line arguments of podman. Fixes: #11370 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
parent
bebaef26fd
commit
f9a689f3ed
|
@ -50,7 +50,7 @@ func init() {
|
|||
timeFlagName := "time"
|
||||
flags.UintVarP(&systemdTimeout, timeFlagName, "t", containerConfig.Engine.StopTimeout, "Stop timeout override")
|
||||
_ = systemdCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
|
||||
flags.BoolVarP(&systemdOptions.New, "new", "", false, "Create a new container instead of starting an existing one")
|
||||
flags.BoolVarP(&systemdOptions.New, "new", "", false, "Create a new container or pod instead of starting an existing one")
|
||||
flags.BoolVarP(&systemdOptions.NoHeader, "no-header", "", false, "Skip header generation")
|
||||
|
||||
containerPrefixFlagName := "container-prefix"
|
||||
|
|
|
@ -32,6 +32,8 @@ Use the name of the container for the start, stop, and description in the unit f
|
|||
|
||||
Using this flag will yield unit files that do not expect containers and pods to exist. Instead, new containers and pods are created based on their configuration files. The unit files are created best effort and may need to be further edited; please review the generated files carefully before using them in production.
|
||||
|
||||
Note that `--new` only works on containers and pods created directly via Podman (i.e., `podman [container] {create,run}` or `podman pod create`). It does not work on containers or pods created via the REST API or via `podman play kube`.
|
||||
|
||||
#### **--no-header**
|
||||
|
||||
Do not generate the header including meta data such as the Podman version and the timestamp.
|
||||
|
|
|
@ -155,7 +155,7 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
|
|||
if config.CreateCommand != nil {
|
||||
createCommand = config.CreateCommand
|
||||
} else if options.New {
|
||||
return nil, errors.Errorf("cannot use --new on container %q: no create command found", ctr.ID())
|
||||
return nil, errors.Errorf("cannot use --new on container %q: no create command found: only works on containers created directly with podman but not via REST API", ctr.ID())
|
||||
}
|
||||
|
||||
nameOrID, serviceName := containerServiceName(ctr, options)
|
||||
|
|
Loading…
Reference in New Issue