podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

Default Profile behavior

Open userid0x0 opened this issue 1 year ago • 1 comments

Describe the bug Hi, I am using the latest devel (as of 3rd November 2023) version of podman-compose. I noticed a difference between docker compose and podman compose in regards of profiles.

Docker seems to have default profiles when there is no --profile / COMPOSE_PROFILES set which is simply an empty string.

version: '3'

services:
  always:
    image: <>
    profiles: ["", "dev"]
    
  productiononly:
    image: <>
    profiles: [""]

The usage is e.g. to have a service that is always started unless a profile is set. Using the example above it skips productiononly if dev is selected. Podman-compose doesn't support the default profile.

To Reproduce docker-compose.yml

version: "3"

services:
  always:
    image: docker.io/library/busybox
    command: ["echo", "always is up"]
    profiles: ["", "dev"]

  productiononly:
    image: docker.io/library/busybox
    command: ["echo", "productiononly is up"]
    profiles: [""]

  devonly:
    image: docker.io/library/busybox
    command: ["echo", "dev is up"]
    profiles: ["dev"]

Using docker compose

$ docker compose up
compose-diff-always-1          | always is up
compose-diff-productiononly-1  | productiononly is up

Using podman compose

$ pip3 install --user --break-system-packages https://github.com/containers/podman-compose/archive/devel.tar.gz
$ export PODMAN_COMPOSE_PROVIDER=~/.local/bin/podman-compose
$ podman compose up
podman-compose version: 1.0.7
['podman', '--version', '']
using podman version: 4.7.2
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=compose-diff', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_compose-diff --infra=false --share=
18fae31787fed41bce05cc23c6d345425f289125ec7152e36269fd869871b465
exit code: 0
# no container is started

Expected behavior I would expect the default profiles are started. A workaround is as follows:

$ podman compose --profile "" up
...
[always]         | always is up
[productiononly] | productiononly is up

Output

$ podman-compose version
using podman version: 4.7.2
podman-compose version 1.0.7
podman --version 
podman version 4.7.2

Environment:

  • OS: Linux
  • podman version: 4.7.2
  • podman compose version: devel 3.11.2023

userid0x0 avatar Nov 03 '23 08:11 userid0x0

Hm, I stepped upon the profiles handling as well, when I'm trying to use the nextcloud all-in-one manual install.

For me, it looked like all profiles were always started (even without giving an --profile option with podman-compose version 1.0.6).

aanno avatar Feb 13 '24 16:02 aanno