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

extends -> file used more than once does not work in podman-compose correctly for 2nd and next services #465

Open
diodakus opened this issue Mar 30, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@diodakus
Copy link

Describe the bug
When docker-compose.yml use extends tag what loads config by file tag from docker-compose-general.yml file for first service from docker-compose.yml - sh works well, but for second ci-dev-sh not. It means that incorrectly recognize docker image for second service - ci-dev-sh and does not inherit mounts from sh.

To Reproduce
Steps to reproduce the behavior:

  1. create docker-compose.yml file with content:
version: '3.5'
services:
  sh:
    extends:
      file: docker-compose-general.yml
      service: sh2

  ci-dev-sh:
    extends:
      file: docker-compose-general.yml
      service: ci-dev-sh2
  1. create docker-compose-general.yml file with content:
services:
  sh2:
    command: [/bin/sh]
    image: busybox
    volumes:
      - /tmp/service_sh:/tmp/service_sh:rw

  ci-dev-sh2:
    extends:
      service: sh2
    volumes:
      - /tmp/service_ci-dev-sh:/tmp/service_ci-dev-sh:rw
  1. run 1st command: podman-compose run --rm sh sh
  2. run 2nd command: podman-compose run --rm ci-dev-sh sh

1st command works as expected - started sh service:
podman run --name=slawek_sh_tmp50285 --rm -i --pod=pod_slawek --label io.podman.compose.config-hash=ff28310f0c2bb389c418e1a834ea9801adacc3f014ac99dabed617361ca2278f --label io.podman.compose.project=slawek --label io.podman.compose.version=1.0.4 --label com.docker.compose.project=slawek --label com.docker.compose.project.working_dir=/home/slawek --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=sh -v /tmp/service_sh:/tmp/service_sh:rw --net slawek_default --network-alias sh --tty busybox sh

Expected behavior for 2nd command
podman run --name=slawek_ci-dev-sh_tmp43794 --rm -i --pod=pod_slawek --label io.podman.compose.config-hash=ff28310f0c2bb389c418e1a834ea9801adacc3f014ac99dabed617361ca2278f --label io.podman.compose.project=slawek --label io.podman.compose.version=1.0.4 --label com.docker.compose.project=slawek --label com.docker.compose.project.working_dir=/home/slawek --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=ci-dev-sh -v /tmp/service_sh:/tmp/service_sh:rw -v /tmp/service_ci-dev-sh:/tmp/service_ci-dev-sh:rw --net slawek_default --network-alias ci-dev-sh --tty busybox sh

  1. Expected docker image busybox.
  2. Expected mount inherited from sh service: -v /tmp/service_sh:/tmp/service_sh:rw.

Actual behavior for 2nd command
podman run --name=slawek_ci-dev-sh_tmp43794 --rm -i --pod=pod_slawek --label io.podman.compose.config-hash=ff28310f0c2bb389c418e1a834ea9801adacc3f014ac99dabed617361ca2278f --label io.podman.compose.project=slawek --label io.podman.compose.version=1.0.4 --label com.docker.compose.project=slawek --label com.docker.compose.project.working_dir=/home/slawek --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=ci-dev-sh -v /tmp/service_ci-dev-sh:/tmp/service_ci-dev-sh:rw --net slawek_default --network-alias ci-dev-sh --tty slawek_ci-dev-sh sh

  1. Bad docker image. Is: slawek_ci-dev-sh, should be: busybox
  2. Missing mount -v /tmp/service_sh:/tmp/service_sh:rw - looks like not inherited from service sh.

Output

$ podman-compose version # Version from 29.03.2022
podman-compose version: 1.0.4
['podman', '--version', '']
using podman version: 3.4.2
podman-composer version 1.0.4
podman --version 
podman version 3.4.2
exit code: 0

Environment:

  • OS: Rocky Linux release 8.5 (Green Obsidian)
  • podman version: 3.4.2
  • podman compose version: (git hex) fbff315
@diodakus diodakus added the bug Something isn't working label Mar 30, 2022
@UnconventionalMindset
Copy link

UnconventionalMindset commented Dec 19, 2022

I experienced the same:

$ cat container-compose.yml
version: '3.5'
services:
  qbittorrent:
    image: docker.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    environment:
      - PUID=1000
      - PGID=1000
      - WEBUI_PORT=8085
      - TZ=Europe/Zurich
    volumes:
      - /mnt/shared/apps/docker/qbittorrent/config:/config
      - /var/home/core/apps/docker/qbittorrent/downloads:/downloads:Z


    ports:
      - 6881:6881
      - 6881:6881/udp
      - 8085:8085
    restart: 'unless-stopped'
$ sudo podman-compose up -d
['podman', '--version', '']
using podman version: 4.3.1
 ** merged:
 {
  "_dirname": "/var/home/core/.config/containers/compose/qbittorrent",
  "version": "3.5",
  "services": {
    "qbittorrent": {
      "image": "docker.io/linuxserver/qbittorrent:latest",
      "container_name": "qbittorrent",
      "environment": {
        "PUID": "1000",
        "PGID": "1000",
        "WEBUI_PORTS": "8086",
        "UMASK": "002",
        "TZ": "Europe/Zurich",
        "WEBUI_PORT": "8085"
      },
      "volumes": [
        "/var/home/core/apps/docker/qbittorrent/downloads:/downloads",
        "/mnt/shared/apps/docker/qbittorrent/config:/config",
        "/var/home/core/apps/docker/qbittorrent/downloads:/downloads:Z"
      ],
      "ports": [
        "6881:6881",
        "6881:6881/udp",
        "8086:8086",
        "6881:6881",
        "6881:6881/udp",
        "8085:8085"
      ],
      "restart": "unless-stopped"
    }
  }
}
** excluding:  set()
['podman', 'network', 'exists', 'qbittorrent_default']
podman run --name=qbittorrent -d --label io.podman.compose.config-hash=123 --label io.podman.compose.project=qbittorrent --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=qbittorrent --label com.docker.compose.project.working_dir=/var/home/core/.config/containers/compose/qbittorrent --label com.docker.compose.project.config_files=docker-compose.yml,container-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=qbittorrent -e PUID=1000 -e PGID=1000 -e WEBUI_PORTS=8086 -e UMASK=002 -e TZ=Europe/Zurich -e WEBUI_PORT=8085 -v /var/home/core/apps/docker/qbittorrent/downloads:/downloads -v /var/mnt/shared/apps/docker/qbittorrent/config:/config -v /var/home/core/apps/docker/qbittorrent/downloads:/downloads:Z --net qbittorrent_default --network-alias qbittorrent -p 6881:6881 -p 6881:6881/udp -p 8086:8086 -p 6881:6881 -p 6881:6881/udp -p 8085:8085 --restart unless-stopped docker.io/linuxserver/qbittorrent:latest
Error: /downloads: duplicate mount destination
exit code: 125
podman start qbittorrent
Error: no container with name or ID "qbittorrent" found: no such container
exit code: 125

As you can see podman-compose is still picking up the old folder /var/mnt/shared/apps/docker/qbittorrent/config which is removed by now. The OS was restarted as well prior to this command execution.
It's almost like the previous versions of the config were appended.

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

2 participants