Skip to content

Port forwarding with podman machine for 127.0.0.1 should work #11528

Closed

Description

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When using podman machine (created via simple podman machine init/podman machine start) on macOS, port forwarding with explicit 127.0.0.1 for host does not work, most likely because the listen address is passed as is into the virtual machine, and then the proxy tool cannot connect to the virtual machine's port (which is visible by stray error log entries from tcpproxy).

Steps to reproduce the issue:

> podman machine init
> podman machine start
> podman run -d -p 18888:80 docker.io/library/nginx
8355e4fa8ce0161f7517207a34f5480359c123f3922e3600712c574af2a53e0b
> podman run -d -p 127.0.0.1:28888:80 docker.io/library/nginx
713a04a35b03bf02747c11757de7382f3ef773d4c2ffd38bbcb931a5e2035dac
> curl -s -I localhost:18888 | head -n1
HTTP/1.1 200 OK
> curl -s -I localhost:28888 | head -n1
2021/09/10 17:01:54 tcpproxy: for incoming conn 127.0.0.1:53866, error dialing "192.168.127.2:28888": connect tcp 192.168.127.2:28888: connection was refused

Describe the results you received:

cURL call to 28888 in the above example fails, while the same call to 18888 succeeds.

Describe the results you expected:

Both calls succeed.

Additional information you deem important (e.g. issue happens only occasionally):

Discovered this when trying to use podman instead of Docker Deskop together with some internal script which always uses 127.0.0.1 for listen host (and cannot be configured not to do so).

Note that Docker for Mac supports 127.0.0.1 as expected, so the above commands reproduced with Docker work.

Output of podman version:

Client:
Version:      3.3.1
API Version:  3.3.1
Go Version:   go1.17
Built:        Mon Aug 30 12:15:26 2021
OS/Arch:      darwin/amd64

Server:
Version:      3.3.1
API Version:  3.3.1
Go Version:   go1.16.6
Built:        Mon Aug 30 13:46:36 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.22.3
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.29-2.fc34.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: '
  cpus: 1
  distribution:
    distribution: fedora
    version: "34"
  eventLogger: journald
  hostname: localhost
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.13.13-200.fc34.x86_64
  linkmode: dynamic
  memFree: 126861312
  memTotal: 2061852672
  ociRuntime:
    name: crun
    package: crun-1.0-1.fc34.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.0
      commit: 139dc6971e2f1d931af520188763e984d6cdfbf8
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc34.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.0
  swapFree: 0
  swapTotal: 0
  uptime: 50m 39.36s
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 3
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 3
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.3.1
  Built: 1630356396
  BuiltTime: Mon Aug 30 20:46:36 2021
  GitCommit: ""
  GoVersion: go1.16.6
  OsArch: linux/amd64
  Version: 3.3.1

Package info (e.g. output of rpm -q podman or apt list podman):

> brew info podman
podman: stable 3.3.1 (bottled), HEAD
<snip>

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes (3.3.1 seems like the latest version now)

Additional environment details (AWS, VirtualBox, physical, etc.):

Running under macOS Big Sur 11.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

In ProgressThis issue is actively being worked by the assignee, please do not work on this at this time.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.machine

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions