mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
Specify format to buildah before commit
If user specifies commit --format, we were not setting it before commit, this caused warning messages that made no sense to be printed that made no sense. Fixes: https://github.com/containers/podman/issues/17773 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user