Skip to content

container started with podman compose can't resolve dns names of others container in the same network #26198

@danielepintore

Description

@danielepintore

Issue Description

Hello, this is a regression. I have a simple docker compose file with pgadmin and a postgres instance. When configuring pgadmin I usually put the name of the container that runs the database, this usually works and resolves it to the correct ip addres but it doesn't work anymore with the latest update.
The latest versions where I know that everything was working fine are:
podman 5.4.2-2
podman-compose 1.3.0-1
netavark 1.14.1-1
aardvark-dns 1.14.0-1

With these versions it doesn't work anymore:
podman 5.5.0-1
podman-compose 1.4.0-1
netavark 1.15.0-1
aardvark-dns 1.15.0-1

Steps to reproduce the issue

Here it is my docker file:

services:
  postgres:
    image: postgres:alpine3.18
    restart: always
    ports:
      - 5432:5432
    environment:
      POSTGRES_DB: agendacloud
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    volumes:
      - postgres:/var/lib/postgresql/data
    networks:
        - db_net

  pgadmin:
    image: dpage/pgadmin4:latest
    environment:
      PGADMIN_DEFAULT_EMAIL: [email protected]
      PGADMIN_DEFAULT_PASSWORD: admin
      PGADMIN_LISTEN_PORT: 80
      PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
      PGADMIN_CONFIG_SERVER_MODE: 'False'
    ports:
      - 15432:80
    volumes:
      - pgadmin:/var/lib/pgadmin:U
    depends_on:
      - postgres
    networks:
        - db_net

volumes:
  postgres:
  pgadmin:

networks:
  db_net:

Just download and run podman compose up, then open the browser on http://localhost:15432/ and click on add server. Put a name and then in the connection tab put postgres as hostname and postgres as password.
Try to connect and you can see an error that says connection refused from localhost.

Describe the results you received

It can't resolve the database container hostname. Instead it says connection refused from localhost.

connection failed: connection to server at "127.0.0.1", port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
`

### Describe the results you expected

I expect a connection.

### podman info output

```yaml
host:
  arch: amd64
  buildahVersion: 1.40.0
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.13-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.13, commit: 82de887596ed8ee6d9b2ee85e4f167f307bb569b'
  cpuUtilization:
    idlePercent: 95.36
    systemPercent: 0.78
    userPercent: 3.86
  cpus: 12
  databaseBackend: sqlite
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 2035
  hostname: thinkpad-x1
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.12.30-1-lts
  linkmode: dynamic
  logDriver: journald
  memFree: 17912430592
  memTotal: 33309319168
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.15.0-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.15.0
    package: netavark-1.15.0-1
    path: /usr/lib/podman/netavark
    version: netavark 1.15.0
  ociRuntime:
    name: crun
    package: crun-1.21-1
    path: /usr/bin/crun
    version: |-
      crun version 1.21
      commit: 10269840aa07fb7e6b7e1acff6198692d8ff5c88
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2025_05_12.8ec1341-1
    version: ""
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.3.2-1
    version: |-
      slirp4netns version 1.3.2
      commit: 0f13345bcef588d2bb70d662d41e92ee8a816d85
      libslirp: 4.9.0
      SLIRP_CONFIG_VERSION_MAX: 6
      libseccomp: 2.5.6
  swapFree: 0
  swapTotal: 0
  uptime: 0h 34m 20.00s
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/daniele/.config/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 2
    stopped: 3
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/daniele/.local/share/containers/storage
  graphRootAllocated: 509944860672
  graphRootUsed: 446966960128
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 5
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/daniele/.local/share/containers/storage/volumes
version:
  APIVersion: 5.5.0
  Built: 1747641392
  BuiltTime: Mon May 19 09:56:32 2025
  GitCommit: 0dbcb51477ee7ab8d3b47d30facf71fc38bb0c98
  GoVersion: go1.24.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.5.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.networkNetworking related issue or featureregressiontriagedIssue has been triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions