fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 644 forks source link

Intermediate images not removed when running podman #1676

Open attiand opened 1 year ago

attiand commented 1 year ago

Description

Intermediate images not removed when running podman. Docker-maven-plugin issues a warning, the warning looks to be related to #1625

Output from Maven (formatted the output for better readability):

[INFO] DOCKER> [fabric8io-test:0.0.1-SNAPSHOT]: Created docker-build.tar in 23 milliseconds
[INFO] DOCKER> [fabric8io-test:0.0.1-SNAPSHOT]: Built image sha256:7f00c
[WARNING] DOCKER> fabric8io-test:0.0.1-SNAPSHOT: Unable to remove image [sha256:7f00c] :
{"cause":"normalizing name for compat API: sha256:7f00c: invalid format: no 64-byte hexadecimal value",
"message":"normalizing image: normalizing name for compat API: sha256:7f00c: invalid format: no 64-byte hexadecimal value","response":500
} 
(Internal Server Error: 500) (dangling image) [{"cause":"normalizing name for compat API: sha256:7f00c: invalid format: no 64-byte hexadecimal value","message":"normalizing image: normalizing name for compat API: sha256:7f00c: invalid format: no 64-byte hexadecimal value","response":500} (Internal Server Error: 500)]

The image id 7f00c from the warning message is still around:

podman images | grep 7f00c
<none>                                                  <none>                                    7f00c3ef4b09  3 minutes ago   666 MB

Info

attiand commented 1 year ago

The REST request issued from the plugin won't work with the podman API:

curl -X DELETE --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock http://v1.41/images/sha256%3Adb7e6?force=1
{"cause":"normalizing name for compat API: sha256:db7e6: invalid format: no 64-byte hexadecimal value","message":"normalizing image: normalizing name for compat API: sha256:db7e6: invalid format: no 64-byte hexadecimal value","response":500}

This however works:

curl -X DELETE --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock http://v1.41/images/sha256%3Adb7e6c4e79c56d5cef1e0bb5eb76e4ba729afdd37452d09b9fd10632ca109cde?force=1
[{"Deleted":"db7e6c4e79c56d5cef1e0bb5eb76e4ba729afdd37452d09b9fd10632ca109cde"},
...

I found no definition of the format of a image name or id from the Docker REST API: https://docs.docker.com/engine/api/v1.41/#tag/Image/operation/ImageDelete

However the OCI specification suggest 256 bits: https://github.com/opencontainers/image-spec/blob/main/config.md#imageid