containers / containers/podman-compose
Default Profile behavior
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**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*
```bash
$ docker compose up
compose-diff-always-1 | always is up
compose-diff-productiononly-1 | productiononly is up
```
Using *podman compose*
```bash
$ 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:
```bash
$ 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
Contributor guide
Assessment
This issue has not been assessed yet.