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

Cant access container using ipv4 when installed podman in WSL2 #13245

Closed
wanjuntham opened this issue Feb 16, 2022 · 4 comments
Closed

Cant access container using ipv4 when installed podman in WSL2 #13245

wanjuntham opened this issue Feb 16, 2022 · 4 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@wanjuntham
Copy link

wanjuntham commented Feb 16, 2022

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

/kind bug

Description

I want to access containers running in podman, which is installed in WSL2 of my windows machine. I can only access the said container with IPv6 address ([::1]) for localhost, but not the IPv4 (127.0.0.1) address of it.

Steps to reproduce the issue:

  1. Run this command in linux terminal of WSL.
    podman container run -d --rm --name nginx -p 8080:80 nginx

  2. Access http://127.0.0.1:8080 in the browser of windows.

  3. Access http://[::1]:8080 in the browser of windows.

Describe the results you received:

  • ERR_CONNECTION_REFUSED for step 2.
  • Valid response body for step 3.

Describe the results you expected:

Should get the same response from step 2, like step 3.

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

  • Tried running a node app directly from WSL2, I can access it on windows machine with both IPv4 or IPv6.

Output of podman version:

Version:      3.0.1
API Version:  3.0.0
Go Version:   go1.15.9
Built:        Thu Jan  1 07:30:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.19.6
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/bin/conmon'
    path: /usr/bin/conmon
    version: 'conmon version 2.0.25, commit: unknown'
  cpus: 12
  distribution:
    distribution: debian
    version: "11"
  eventLogger: file
  hostname: W1055NXCB3
  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: 5.10.16.3-microsoft-standard-WSL2
  linkmode: dynamic
  memFree: 23950974976
  memTotal: 26694303744
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.17
      commit: 0e9229ae34caaebcb86f1fde18de3acaf18c6d9a
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /tmp/podman-run-1000/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: true
    seccompEnabled: true
    selinuxEnabled: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.0.1
      commit: 6a7b16babc95b6a3056b33fb45b74a6f62262dd4
      libslirp: 4.4.0
  swapFree: 7516192768
  swapTotal: 7516192768
  uptime: 7h 5m 59.01s (Approximately 0.29 days)
registries: {}
store:
  configFile: /home/wanjun23/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
      Version: |-
        fusermount3 version: 3.10.3
        fuse-overlayfs: version 1.4
        FUSE library version 3.10.3
        using FUSE kernel interface version 7.31
  graphRoot: /home/wanjun23/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 7
  runRoot: /tmp/podman-run-1000/containers
  volumePath: /home/wanjun23/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 0
  BuiltTime: Thu Jan  1 07:30:00 1970
  GitCommit: ""
  GoVersion: go1.15.9
  OsArch: linux/amd64
  Version: 3.0.1

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

Listing... Done
podman/stable,now 3.0.1+dfsg1-3+b2 amd64 [installed]

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

No(Checked troubleshooting guide, but havent tested with the latest version of Podman).

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

Podman installed on Debian image on WSL2.

@Luap99
Copy link
Member

Luap99 commented Feb 16, 2022

This sounds like a problem with wsl on not podman, does ss -tulpn shows that the port is binded on linux?

@wanjuntham
Copy link
Author

wanjuntham commented Feb 16, 2022

Yes.

Here is the result of the command ss -tulpn.

$ ss -tulpn
Netid   State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port   Process
tcp     LISTEN    0         511              127.0.0.1:36037            0.0.0.0:*       users:(("node",pid=24,fd=18))
tcp     LISTEN    0         4096                     *:8080                   *:*       users:(("exe",pid=23632,fd=12))

@Luap99 added 1 more point in Additional information you deem important section.

@davdr
Copy link

davdr commented Feb 16, 2022

It's a known WSL2 problem. Analysis & workaround here: #12292 (comment)

@wanjuntham
Copy link
Author

It's a known WSL2 problem. Analysis & workaround here: #12292 (comment)

Thank you for the analysis and workaround, this works on my end.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants