Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman containers on Windows cannot connect to the host via localhost #24660

Open
flibustier7seas opened this issue Nov 23, 2024 · 0 comments
Open
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote windows issue/bug on Windows

Comments

@flibustier7seas
Copy link

Issue Description

Podman containers on Windows cannot connect to the host via localhost.

Steps to reproduce the issue

Invoke-WebRequest -Uri http://localhost:5079 | Select-Object StatusCode

# StatusCode
# ----------
#        200


docker run --rm --network host curlimages/curl -I -X GET http://localhost:5079

#   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#                                  Dload  Upload   Total   Spent    Left  Speed
#   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
#   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
# Content-Type: application/json; charset=utf-8
# Date: Sat, 23 Nov 2024 13:31:55 GMT
# Server: Kestrel
# Transfer-Encoding: chunked

podman run --rm --network host curlimages/curl -I -X GET http://localhost:5079

#   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#                                  Dload  Upload   Total   Spent    Left  Speed
#   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
# curl: (7) Failed to connect to localhost port 5079 after 0 ms: Could not connect to server

Describe the results you received

Podman container cannot connect to a port exposed on the host via localhost.

Describe the results you expected

Podman container can connect to a port exposed on the host via localhost.

podman info output

host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.12-2.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 99.8
    systemPercent: 0.1
    userPercent: 0.1
  cpus: 20
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: container
    version: "40"
  eventLogger: journald
  freeLocks: 1991
  hostname: MyPC
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
  kernel: 5.15.167.4-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 15142686720
  memTotal: 16626593792
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.12.2-2.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark-1.12.2-1.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.12.2
  ociRuntime:
    name: crun
    package: crun-1.18.2-1.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.18.2
      commit: 00ab38af875ddd0d1a8226addda52e1de18339b5
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20241030.gee7d0b6-1.fc40.x86_64
    version: |
      pasta 0^20241030.gee7d0b6-1.fc40.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: unix:///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: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 4294967296
  swapTotal: 4294967296
  uptime: 0h 30m 26.00s
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 45
    paused: 0
    running: 0
    stopped: 45
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 1081101176832
  graphRootUsed: 9572601856
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 21
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 5.3.0
  Built: 1731456000
  BuiltTime: Wed Nov 13 01:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.7
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.0
  Version: 5.3.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

No

Additional environment details

podman version

# Client:       Podman Engine
# Version:      5.2.5
# API Version:  5.2.5
# Go Version:   go1.23.2
# Git Commit:   10c5aa720d59480bc7edad347c1f5d5b75d4424f
# Built:        Wed Oct 23 19:54:08 2024
# OS/Arch:      windows/amd64
# 
# Server:       Podman Engine
# Version:      5.3.0
# API Version:  5.3.0
# Go Version:   go1.22.7
# Built:        Wed Nov 13 01:00:00 2024
# OS/Arch:      linux/amd64

podman machine inspect

# [
#      {
#           "ConfigDir": {
#                "Path": "C:\\Users\\MyUser\\.config\\containers\\podman\\machine\\wsl"
#           },
#           "ConnectionInfo": {
#                "PodmanSocket": null,
#                "PodmanPipe": {
#                     "Path": "\\\\.\\pipe\\podman-machine-default"
#                }
#           },
#           "Created": "2024-11-21T11:45:15.1653755+01:00",
#           "LastUp": "2024-11-23T14:25:53.592163+01:00",
#           "Name": "podman-machine-default",
#           "Resources": {
#                "CPUs": 10,
#                "DiskSize": 100,
#                "Memory": 2048,
#                "USBs": []
#           },
#           "SSHConfig": {
#                "IdentityPath": "C:\\Users\\MyUser\\.local\\share\\containers\\podman\\machine\\machine",
#                "Port": 58684,
#                "RemoteUsername": "user"
#           },
#           "State": "running",
#           "UserModeNetworking": false,
#           "Rootful": false,
#           "Rosetta": false
#      }
# ]

wsl --version

# WSL version: 2.3.26.0
# Kernel version: 5.15.167.4-1
# WSLg version: 1.0.65
# MSRDC version: 1.2.5620
# Direct3D version: 1.611.1-81528511
# DXCore version: 10.0.26100.1-240331-1435.ge-release
# Windows version: 10.0.22631.4460

Additional information

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

@flibustier7seas flibustier7seas added the kind/bug Categorizes issue or PR as related to a bug. label Nov 23, 2024
@github-actions github-actions bot added remote Problem is in podman-remote windows issue/bug on Windows labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote windows issue/bug on Windows
Projects
None yet
Development

No branches or pull requests

1 participant