containers / containers/podman-compose
communication between dependent container (in a pod)
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
I am currently trying to automate and update the tests from the "tests" folder but I am running into lots of issues. Not to say, there is only the simplest build test running out of the box right now. I am currently trying to get the "deps" test to run, and having major issues with the infrastructure in pods. First I thought it is an configuration/runtime/network stack issue. But without podman-compose everything works fine on all of my systems (WSL Ubuntu 22.4.2 LTS, Raspi with Debian and custom yocto build).
**To Reproduce**
Create a compose file with following content
```yaml
version: "3.7"
services:
web:
image: docker.io/library/httpd
sleep:
image: docker.io/library/busybox
command: ["/bin/sh", "-c", "sleep 3600"]
depends_on: "web"
```
and run either
`podman-compose run --rm sleep /bin/sh -c 'wget -O - localhost'`
--> no pod created
or
`podman-compose --in-pod=1 run --rm sleep /bin/sh -c 'wget -O - localhost'`
--> as the podman-compose output already shows, the generated pod is with infra=false, this don't make any sense to me and probably should be discussed. But ok, lets add it with the next command.
or
`podman-compose --in-pod=1 --pod-args='--infra=true --share=""' run --rm sleep /bin/sh -c 'wget -O - localhost'`
--> call for creating the pod is again different to the simple `podman pod create` but that was expected, due to the arguments.
or
`podman-compose --in-pod=1 --pod-args='' run --rm sleep /bin/sh -c 'wget -O - localhost'`
--> now at least the output looks like it is doing what expected (besides it is calling "podman pod create" twice, BUG?), just calling `podman pod create`. But the result is still the same:
```bash
podman-compose --in-pod=1 --pod-args='' run --rm sleep /bin/sh -c 'wget -O - localhost'
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.4.4-dev
podman pod create --name=pod_test
aadb0ccbb70cda6c02f0fb50853f8aab53cef0931a87562106bdba0c796033a4
exit code: 0
** excluding: {'sleep'}
['podman', 'ps', '--filter', 'label=io.podman.compose.project=test', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_test
Error: adding pod to state: name "pod_test" is in use: pod already exists
exit code: 125
['podman', 'network', 'exists', 'test_default']
podman run --name=test_web_1 -d --pod=pod_test --label io.podman.compose.config-hash=bd62412209daa588f610a103ec77ef0099aaf57a585be19814b8416a49b9f802 --label io.podman.compose.project=test --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@test.service --label com.docker.compose.project=test --label com.docker.compose.project.working_dir=/opt/plcnext/test --label com.docker.compose.project.config_files=docker-compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=web --net test_default --network-alias web docker.io/library/httpd
97a2321ab159f45160dc3112464edd8b908ff9198f67fe9e02ad39576c5ddf3a
exit code: 0
** skipping: test_sleep_1
['podman', 'network', 'exists', 'test_default']
podman run --name=test_sleep_tmp21147 --rm -i --pod=pod_test --requires=test_web_1 --label io.podman.compose.config-hash=bd62412209daa588f610a103ec77ef0099aaf57a585be19814b8416a49b9f802 --label io.podman.compose.project=test --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@test.service --label com.docker.compose.project=test --label com.docker.compose.project.working_dir=/opt/plcnext/test --label com.docker.compose.project.config_files=docker-compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=sleep --net test_default --network-alias sleep --tty docker.io/library/busybox /bin/sh -c wget -O - localhost
Connecting to localhost (127.0.0.1:80)
wget: can't connect to remote host (127.0.0.1): Connection refused
exit code: 1
```
**Expected behavior**
Same as when running podman without podman-compose:
```bash
podman pod create --name=web-pod
podman container run -d --pod web-pod --name=web-container docker.io/library/httpd
podman container run -it --rm --pod web-pod docker.io/library/busybox wget -O - localhost
Connecting to localhost (127.0.0.1:80)
writing to stdout
It works!
- 100% |*******************************************************************************************| 45 0:00:00 ETA
written to stdout
```
**Output**
```
$ podman-compose version
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.4.4-dev
podman-compose version 1.0.6
podman --version
podman version 4.4.4-dev
exit code: 0
```
**Environment:**
- OS: Linux
- podman version: 4.4.4-dev (from yocto master branch)
- podman compose version: Release Tag 1.0.6
**Additional context**
The target system is a custom yocto build linux using runc and netavark. But the behavior is reproducible on a Ubuntu 22.04 WSL and Raspi with crun and cni.
Contributor guide
Assessment
This issue has not been assessed yet.