-
Notifications
You must be signed in to change notification settings - Fork 534
Description
Describe the bug
In our compose.yml
files, we make active use of profiles to group services together. It it my understanding, that proper profiles support was just recently added to podman-compose
, and the newest release (1.1.0) seems to break a bunch of things because of that.
More precisely, if a service has an associated profile, building or running it doesn't seem to work without explicitly specifying a profile that service belongs to. For example, if a service test
has profiles: [test_profile]
, then calling podman-compose build test
fails and podman-compose --profile test_profile build test
seems to be required.
On the other hand, using docker compose
, one doesn't need to specify a profile, and I believe that that's the correct behaviour. Quoting from the spec concerning profiles:
A service is ignored by Compose when none of the listed profiles match the active ones, unless the service is explicitly
targeted by a command. In that case its profile is added to the set of active profiles.
The way I interpret this, calling podman-compose build test
does explicitly target the test
service and specifying the profile should not be necessary.
This happens on both the released version 1.1.0, as well as the latest version in the main
branch.
To Reproduce
-
Create a
Dockerfile
and acompose.yml
file setting up a single, minimal service that has an assigned profile.Dockerfile
:FROM docker.io/library/alpine:latest CMD [ "true" ]
compose.yml
:services: test: image: test:latest profiles: [test_profile] build: context: . dockerfile: Dockerfile
-
Try to build the service:
$ podman-compose build test WARNING:podman_compose:missing services [test]
However, when explicitly specifying a profile as in
podman-compose --profile test_profile build test
, it works. -
Similarly, running the service without an explicitly set profile (i.e.
podman-compose run test
) also fails. If the profile is specified, everything works as expected.
Expected behavior
Building or running a service should be possible without explicitly specifying a profile that service is associated with.
Actual behavior
The service is not correctly identified, presumably because none of its listed profiles is active.
Output
$ podman-compose version
podman-compose version 1.1.0
podman version 4.9.4
Environment:
- OS: Linux