containers / containers/podman-compose
Support building & pushing multiarch manifests
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to build multiarch images for services defined in a `compose.yaml` file. The idea is to build, bring the services up, test, and (if the tests are successful) then push the multiarch images to a registry. Podman Compose can *use* existing multiarch images just fine (if `services..image` points at the manifest), but building or pushing does not work.
**Describe the solution you'd like**
For `podman-compose build` I'd like to have a `--platform` parameter that works like for `podman build`. The image name should then be passed as the `--manifest` option instead of `--tag`. An optimization could be to limit multiarch builds to services with an `image` option set, considering others are unlikely to be pushed anyway.
Likewise `podman-compose push` should do a manifest push (`podman manifest push`) if there is a multiarch manifest with the given tag.
**Describe alternatives you've considered**
I've tried passing `--podman-build-args=--platform=...` and `--podman-build-args=--manifest=...` and build the services one by one (because the need different manifest names). Unfortunately this breaks because Podman Compose still passes a `-t` parameter, apparently that takes precedence over `--manifest` in `podman build`, and the build for the second arch fails because the image cannot be added to the manifest (because the tag now points to the image for the first arch, not a manifest).
Currently I'm using a script to work around the limitation: Use `podman-compose config` to get the expanded config, and assemble `podman build --platform ...` and `podman manifest push` command lines for any services with an `image` setting from their `build` sections. The resulting multiarch images work with `podman-compose up` as mentioned above.
Contributor guide
Research direction
Start by tracing the podman-compose build and push command entry points, then compare the requested --platform, --manifest, and podman manifest push behavior with the current command construction. Done means multiarch services can build into manifests and podman-compose push can push a manifest when the tag refers to one.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100