containers / containers/podman-compose
Port not associated with container when added to a pod
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I create a pod with the command `podman pod create -p 3016:8000 -p 3017:6379 ....` and then add a container to the pod with the command `pod run --pod ...`, the ports specified in the pod are also associated with the containers:
```bash
pod_cryptgeon cryptgeon_infra Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp, 0.0.0.0:3017->6379/tcp
pod_cryptgeon cryptgeon_cache Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp, 0.0.0.0:3017->6379/tcp
pod_cryptgeon cryptgeon_app Exited (101) 3 days ago 0.0.0.0:3016->8000/tcp, 0.0.0.0:3017->6379/tcp
```
But if I use a compose file, the ports are not associated with the containers.
```bash
pod_cryptgeon cryptgeon_infra Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp
pod_cryptgeon cryptgeon_cache Exited (0) 16 hours ago 6379/tcp
pod_cryptgeon cryptgeon_app Exited (101) 3 days ago 8000/tcp
```
**To Reproduce**
Steps to reproduce the behavior:
1. create a compose file with instructions for creating a pod with published ports (see the compose file to the end of issue).
**Expected behavior**
The ports need to be associated also with the container
```bash
pod_cryptgeon cryptgeon_infra Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp, 0.0.0.0:3017->6379/tcp
pod_cryptgeon cryptgeon_cache Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp
, 0.0.0.0:3017->6379/tcp
pod_cryptgeon cryptgeon_app Exited (101) 3 days ago 0.0.0.0:3016->8000/tcp, 0.0.0.0:3017->6379/tcp
```
**Actual behavior**
```bash
pod_cryptgeon cryptgeon_infra Exited (0) 16 hours ago 0.0.0.0:3016->8000/tcp
pod_cryptgeon cryptgeon_cache Exited (0) 16 hours ago 6379/tcp
pod_cryptgeon cryptgeon_app Exited (101) 3 days ago 8000/tcp
```
**Environment:**
- OS: Linux debian 13.2
- podman version: 5.4.2
- podman compose version: 1.5.0 (shoud be https://github.com/containers/podman-compose/commit/f7eeda1a3db10952424af6a5b0501c269ebe3f0d commit)
**Additional context**
Upload file makes errore, so i wrote here the compose file:
```yaml
services:
redis:
image: docker.io/redis:latest
container_name: cryptgeon_cache
network_mode: bridge
command: redis-server --save "" --appendonly no --maxmemory 1gb --maxmemory-policy allkeys-lru
tmpfs:
- /data
app:
image: docker.io/cupcakearmy/cryptgeon:latest
container_name: cryptgeon_app
network_mode: bridge
depends_on:
- redis
environment:
REDIS: redis://localhost
SIZE_LIMIT: 4 MiB
x-podman:
in_pod: true
pod_args:
- --infra-name=cryptgeon_infra
- --publish=3016:8000
- --publish=3017:6379
```
Contributor guide
Assessment
This issue has not been assessed yet.