Skip to content

Port not associated with container when added to a pod #1360

@LeonardVertighel

Description

@LeonardVertighel

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:

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.

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

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

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 f7eeda1 commit)

Additional context
Upload file makes errore, so i wrote here the compose file:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions