redhat-actions / push-to-registry

GitHub Action to push a container image to an image registry.
https://github.com/marketplace/actions/push-to-registry
MIT License
97 stars 32 forks source link

[FEATURE] Add option to disable push/pull from Docker daemon #68

Closed der-eismann closed 5 months ago

der-eismann commented 2 years ago

Is your feature request related to a problem? Please describe.

We are having our own runners and are trying to stay Docker-free. To still be able to run actions with containers we added a symlink from podman.sock to docker.sock and let podman run in daemon-mode. However when a Docker socket is available, this action is looking if the image is available there and then pulling it, even if the tags are already available in podman storage, in our case pulling from podman to podman, which doesn't make any sense. To make it worse it's failing at the end because it adds a docker.io prefix, which is not there. IMHO this doesn't make much sense anyway, because if I want to push from Docker, I would use the Docker action and not this one.

Describe the solution you'd like

It would be awesome if there was an option to disable everything Docker-related so it's pure podman.

Describe alternatives you've considered

None

Additional context

Logs of the failing build, if podman is running in daemon-mode with docker.sock:

Run redhat-actions/push-to-registry@v2
Creating temporary Podman image storage for pulling from Docker daemon
Overriding storage mount_program with "fuse-overlayfs" in environment
πŸ” Checking if the given image is manifest or not.
/bin/podman version
/bin/podman manifest exists 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master
/bin/podman manifest exists 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b
πŸ” Checking if "123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master, 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b" present in the local Podman image storage
/bin/podman image exists 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master
/bin/podman image exists 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b
Tags "123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master, 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b" found in Podman image storage
πŸ” Checking if "123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master, 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b" present in the local Docker image storage
/bin/podman --root /tmp/podman-from-docker-G7H07Y --storage-opt overlay.mount_program=/bin/fuse-overlayfs pull docker-daemon:123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master
/bin/podman --root /tmp/podman-from-docker-G7H07Y --storage-opt overlay.mount_program=/bin/fuse-overlayfs pull docker-daemon:123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b
Tags "123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master, 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b" found in Docker image storage
/bin/podman image inspect 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master --format {{.Created}}
2022-08-08 15:08:53.272951074 +0000 UTC
/bin/podman --root /tmp/podman-from-docker-G7H07Y --storage-opt overlay.mount_program=/bin/fuse-overlayfs image inspect docker.io/123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master --format {{.Created}}
Error: inspecting object: docker.io/123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master: image not known
Removing temporary Podman image storage for pulling from Docker daemon
/bin/podman --root /tmp/podman-from-docker-G7H07Y --storage-opt overlay.mount_program=/bin/fuse-overlayfs rmi -a -f
Untagged: 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:8c11373cd846042242f2c2331a5fab779c2f439b
Untagged: 123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master
Deleted: 2801cef2b857fd65b480c4aea2215da8b6241a33f299cc1b08af1c631f58f1ab
Error: podman exited with code 125
Error: inspecting object: docker.io/123456789101.dkr.ecr.eu-west-1.amazonaws.com/example-project:master: image not known
der-eismann commented 2 years ago

I think the main issue here is that the action assumes that if image.split("/").length == 2, the image must be from Docker hub instead of e.g. quay.io, where the value would be 3 (for example for quay.io/foreman/foreman:3.2-stable). But for AWS ECR the value is also 2, so it adds the prefix even though it is not needed.

der-eismann commented 5 months ago

Closing since this project is kinda dead.