If both build: and image: are present, the image builds but is not used, and it's impossible to make use of it even with --build option:
web:
image: caddy:alpine
build: .
Run the service:
$ podman-compose --verbose run --rm --service-ports --build web
...
INFO:podman_compose:podman build -f Containerfile -t caddy:alpine <compose dir>
...
# <compose dir>_web:latest is built..
Successfully tagged localhost/caddy:alpine
Successfully tagged localhost/<compose dir>_web:latest
...
# ..but is not used then - downloaded caddy:alpine is run instead
INFO:podman_compose:podman run ... caddy:alpine
If we remove image:, the image built is used then properly:
$ podman-compose --verbose run --rm --service-ports --build web
...
# <compose dir>_web image is run properly
INFO:podman_compose:podman run ... <compose dir>_web
This behavior doesn't correspond to docker-compose, where build: has a preference.
$ podman-compose version
podman-compose version 1.5.0
podman version 5.8.2
Environment:
If both
build:andimage:are present, the image builds but is not used, and it's impossible to make use of it even with--buildoption:Run the service:
If we remove
image:, the image built is used then properly:This behavior doesn't correspond to docker-compose, where
build:has a preference.Environment: