diff --git a/libpod/container_commit.go b/libpod/container_commit.go index df0a77bc3d..d4db1e447b 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -68,6 +68,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai PreferredManifestType: options.PreferredManifestType, } importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions) + importBuilder.Format = options.PreferredManifestType if err != nil { return nil, err } diff --git a/test/system/010-images.bats b/test/system/010-images.bats index d556ec5579..70184b6a1a 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -309,4 +309,17 @@ Deleted: $pauseID" is "$output" "" "Should print no output" } +@test "podman images - commit docker with comment" { + run_podman run --name my-container -itd $IMAGE sleep 1d + run_podman 125 commit -m comment my-container my-test-image + assert "$output" == "Error: messages are only compatible with the docker image format (-f docker)" "podman should fail unless docker format" + run_podman commit my-container --format docker -m comment my-test-image + run_podman commit -q my-container --format docker -m comment my-test-image + assert "$output" =~ "^[0-9a-f]{64}\$" \ + "Output is a commit ID, no warnings or other output" + + run_podman rmi my-test-image + run_podman rm my-container --force -t 0 +} + # vim: filetype=sh