Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building or Running a Service Fails Without Explicit Profile #930

Open
VerKWer opened this issue May 7, 2024 · 0 comments
Open

Building or Running a Service Fails Without Explicit Profile #930

VerKWer opened this issue May 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@VerKWer
Copy link

VerKWer commented May 7, 2024

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

  1. Create a Dockerfile and a compose.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
  2. 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.

  3. 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
@VerKWer VerKWer added the bug Something isn't working label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant