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

podman-compose starting container twice

Open refriedjello opened this issue 3 years ago • 5 comments

Describe the bug

When I use podman-compose run to launch a new container it is starting the container twice.

The first time it starts, it apparently exits the container with an exit code of 0, then starts the container again and this time leaves it up and running.

To Reproduce

My compose.yml file looks like this:

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

Then while in the same directory as that file, I run the command podman-compose run mything.

Expected behavior

I expect the container to only launch once and insert my terminal session into the container based on defined settings in the compose.yml file.

Actual behavior

It launches a container and exits, then launches another container and stays running as expected.

Output

[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#```

Environment:

  • OS: RHEL 8.6
  • podman version: 1.0.3
  • podman compose version: 4.0.2

refriedjello avatar May 23 '22 17:05 refriedjello

Observing the same behavior with podman 4.1.1 and podman-compose 1.0.3 on Fedora 36. This also makes impossible to properly clean-up resources by running podman-compose down on corresponding YAML (new containers have weird suffixes after the desired name, like docker_test_tmpXXXXX or docker_test_1 instead of configured test).

defanator avatar Jul 21 '22 13:07 defanator

would you please test this with latest devel version

pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz

muayyad-alsadi avatar Jul 21 '22 13:07 muayyad-alsadi

@muayyad-alsadi is there a particular commit u have in mind that resolves this issue that you are recommending using the devel version? Tried to check myself, looks like there are over 100 commits difference, so yeah maybe something did get resolved.

I'm guessing you are not able to reproduce this issue?

acxz avatar Jul 21 '22 20:07 acxz

@muayyad-alsadi sorry for the delay - I've just tried with https://github.com/containers/podman-compose/archive/devel.tar.gz (as of today) - the issue has gone in my particular env; I'm seeing just one container per compose run (exactly as described in the configuration) instead of two. The issue is 100% reproducible with this version of podman-compose from Fedora 36 repos:

$ rpm -qi podman-compose
Name        : podman-compose
Version     : 1.0.3
Release     : 6.fc36
Architecture: noarch
Install Date: Tue 11 Oct 2022 02:33:55 PM UTC
Group       : Unspecified
Size        : 177459
License     : GPLv2
Signature   : RSA/SHA256, Mon 01 Aug 2022 04:53:40 PM UTC, Key ID 999f7cbf38ab71f4
Source RPM  : podman-compose-1.0.3-6.fc36.src.rpm
Build Date  : Mon 01 Aug 2022 04:50:47 PM UTC
Build Host  : buildvm-s390x-18.s390.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://github.com/containers/podman-compose
Bug URL     : https://bugz.fedoraproject.org/podman-compose
Summary     : Run docker-compose.yml using podman
Description :
An implementation of docker-compose with podman backend.
The main objective of this project is to be able to run docker-compose.yml
unmodified and rootless.

Are there any chances to have a new tag/release sooner rather than later?

defanator avatar Oct 11 '22 16:10 defanator

@muayyad-alsadi just came back to this issue and I noticed that I am no longer experiencing this issue.

acxz avatar Dec 29 '23 06:12 acxz