From f9a689f3ed016fcb9e4d9c0614ee9979b1e8ecd7 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 31 Aug 2021 14:51:39 +0200 Subject: 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 --- pkg/systemd/generate/containers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/systemd/generate/containers.go') diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index 931f13972..188926115 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -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) -- cgit v1.2.3-54-g00ecf