diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-01-09 12:27:24 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-01-09 16:12:12 +0100 |
commit | 816e50ba02837946afade83e3cad06dd44d213ec (patch) | |
tree | 67834eb73ab890cb4c9fba8d37f68e3fdec9dcd6 /cmd | |
parent | f3fc10feb42930def6922fc050096ea38bafed7a (diff) | |
download | podman-816e50ba02837946afade83e3cad06dd44d213ec.tar.gz podman-816e50ba02837946afade83e3cad06dd44d213ec.tar.bz2 podman-816e50ba02837946afade83e3cad06dd44d213ec.zip |
podman-generate-systemd --new
Add a --new flag to podman-generate-systemd to create a new container
via podman-run instead of starting an existing container.
Creating a new container presents the challenge to find a reverse
mapping from a container to the CLI flags it can be created with. We
are doing this via `(Container).Config.CreateCommand` field, which
includes a copy of the process' command from procFS at creating time.
This field may not be useful when the container was not created via the
Podman CLI (e.g., via a Python script). Hence, we do not guarantee the
correctness of the generated files.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/cliconfig/config.go | 1 | ||||
-rw-r--r-- | cmd/podman/generate_systemd.go | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go index 0e4315411..b261599e6 100644 --- a/cmd/podman/cliconfig/config.go +++ b/cmd/podman/cliconfig/config.go @@ -163,6 +163,7 @@ type GenerateKubeValues struct { type GenerateSystemdValues struct { PodmanCommand Name bool + New bool Files bool RestartPolicy string StopTimeout int diff --git a/cmd/podman/generate_systemd.go b/cmd/podman/generate_systemd.go index aa202a68d..a9775f9cb 100644 --- a/cmd/podman/generate_systemd.go +++ b/cmd/podman/generate_systemd.go @@ -45,6 +45,7 @@ func init() { } flags.IntVarP(&containerSystemdCommand.StopTimeout, "timeout", "t", -1, "stop timeout override") flags.StringVar(&containerSystemdCommand.RestartPolicy, "restart-policy", "on-failure", "applicable systemd restart-policy") + flags.BoolVarP(&containerSystemdCommand.New, "new", "", false, "create a new container instead of starting an existing one") } func generateSystemdCmd(c *cliconfig.GenerateSystemdValues) error { |