'podman-compose run is launching two containers when it should only run one

I am using podman-compose to launch a container from a compose.yml file.

This is the command I use to launch a new container:

podman-compose run mything

I run that in the same directory as my compose.yml file:

services:
  mything:
    container_name: mything
    image: my.private.repo/my_base_image
    stdin_open: true
    tty: true
    volumes:
      - /host/mount/path:/container/mount/path:Z
    entrypoint: /bin/sh

When I run podman-compose run mything this is the output I get:

[refried.jello@ansible-dev]$ podman-compose run mything
['podman', '--version', '']
using podman version: 4.0.2
** excluding:  set()

['podman', '--version', '']
using podman version: 4.0.2
** excluding:  set()
['podman', 'network', 'exists', 'ansible-dev_default']
podman run --name=mything -d --label io.podman.compose.config-hash=123 --label io.podman.compose.project=ansible-dev --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=ansible-dev --label com.docker.compose.project.working_dir=/home/refried.jello/ansible-dev --label com.docker.compose.project.config_files=compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=mything -v /host/mount/path:/container/mount/path:Z --net ansible-dev_default --network-alias mything -i --tty --entrypoint ["/bin/sh"] my.private.repo/my_base_image
e092e4e7b51d0f1d54370d84b0caa11842dbbfa0b9368edd6056e87266bee684
exit code: 0

['podman', 'network', 'exists', 'ansible-dev_default']
podman run --name=ansible-dev_mything_tmp22845 -i --label io.podman.compose.config-hash=123 --label io.podman.compose.project=ansible-dev --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=ansible-dev --label com.docker.compose.project.working_dir=/home/refried.jello/ansible-dev --label com.docker.compose.project.config_files=compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=mything -v /host/mount/path:/container/mount/path:Z --net ansible-dev_default --network-alias mything -i --tty --entrypoint ["/bin/sh"] my.private.repo/my_base_image
sh-4.4#

It launches a container and then exits on code 0, and then re-launches the container and this time puts me into the container interactively which is the desired outcome.

Looking at the output, the only difference I see between the two commands is the container name. When I exit my container, I am left with two containers, one running and one not.

Is there a way I can stop this from happening, so only one container is launched? Or is this expected behavior?

Edit: I have opened a GitHub issue for this - https://github.com/containers/podman-compose/issues/498



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source