diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-09-15 13:23:42 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-09-15 13:33:22 +0200 |
commit | ce6efadd5cfe48bc8af4798a4747b74398cb4a1e (patch) | |
tree | 042439c6980bede92b1115abbe4da5d28366951d /cmd | |
parent | 5c47a331ba768d57ef94b9595415500f4e911964 (diff) | |
download | podman-ce6efadd5cfe48bc8af4798a4747b74398cb4a1e.tar.gz podman-ce6efadd5cfe48bc8af4798a4747b74398cb4a1e.tar.bz2 podman-ce6efadd5cfe48bc8af4798a4747b74398cb4a1e.zip |
run/create: record raw image
Record the user-specified "raw" image name in the SpecGenerator, so we
can pass it along to the config when creating a container. We need a
separate field as the image name in the generator may be set to the
ID of the previously pulled image - ultimately the cause of #7404.
Reverting the image name from the ID to the user input would not work
since "alpine" for pulling iterates over the search registries in the
registries.conf but looking up "alpine" normalizes to
"localhost/alpine".
Recording the raw-image name directly in the generator was the best of
the options I considered as no hidden magic from search registries or
normalizations (that may or may not change in the future) can interfere.
The auto-update backend enforces that the raw-image name is a
fully-qualified reference, so we need to worry about that in the front
end.
Fixes: #7407
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/create.go | 3 | ||||
-rw-r--r-- | cmd/podman/containers/run.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index f9d33a223..2de1c9c19 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -110,7 +110,9 @@ func create(cmd *cobra.Command, args []string) error { } imageName := args[0] + rawImageName := "" if !cliVals.RootFS { + rawImageName = args[0] name, err := pullImage(args[0]) if err != nil { return err @@ -121,6 +123,7 @@ func create(cmd *cobra.Command, args []string) error { if err := common.FillOutSpecGen(s, &cliVals, args); err != nil { return err } + s.RawImageName = rawImageName if _, err := createPodIfNecessary(s, cliVals.Net); err != nil { return err diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index 34eea14e1..eadfe3a03 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -130,7 +130,9 @@ func run(cmd *cobra.Command, args []string) error { } imageName := args[0] + rawImageName := "" if !cliVals.RootFS { + rawImageName = args[0] name, err := pullImage(args[0]) if err != nil { return err @@ -177,6 +179,7 @@ func run(cmd *cobra.Command, args []string) error { if err := common.FillOutSpecGen(s, &cliVals, args); err != nil { return err } + s.RawImageName = rawImageName runOpts.Spec = s if _, err := createPodIfNecessary(s, cliVals.Net); err != nil { |