Skip to content

Commit

Permalink
container create: do not clear image name
Browse files Browse the repository at this point in the history
When creating a container, do not clear the input-image name before
looking up image names.  Also add a regression test.

Fixes: containers#8558
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Dec 7, 2020
1 parent 035d289 commit f294d89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion pkg/specgen/generate/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
// present.
imgName := newImage.InputName
if s.Image == newImage.InputName && strings.HasPrefix(newImage.ID(), s.Image) {
imgName = ""
names := newImage.Names()
if len(names) > 0 {
imgName = names[0]
Expand Down
11 changes: 11 additions & 0 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,17 @@ json-file | f
run_podman untag $IMAGE $newtag $newtag2
}

# Regression test for issue #8558
@test "podman run on untagged image: make sure that image metadata is set" {
run_podman inspect $IMAGE --format "{{.ID}}"
imageID="$output"

run_podman untag $IMAGE
run_podman run --rm $imageID ls

run_podman tag $imageID $IMAGE
}

@test "Verify /run/.containerenv exist" {
run_podman run --rm $IMAGE ls -1 /run/.containerenv
is "$output" "/run/.containerenv"
Expand Down

0 comments on commit f294d89

Please sign in to comment.