docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 118 forks source link

Ping inside a container on M1 Mac not working #6802

Open sj14 opened 1 year ago

sj14 commented 1 year ago

Expected behavior

A ping to a valid target should succeed

Actual behavior

100% packet loss of the ping request

Information

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

[2023-04-12T06:25:38.891087000Z][com.docker.diagnose][I] set path configuration to OnHost
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0038: is the connection to Docker working?
[PASS] DD0014: are the backend processes running?
[PASS] DD0007: is the backend responding?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0032: do Docker networks overlap with host IPs?
No fatal errors detected.

Steps to reproduce the behavior

  1. Ping from your host machine
    ➜  ~ ping 8.8.8.8
    PING 8.8.8.8 (8.8.8.8): 56 data bytes
    64 bytes from 8.8.8.8: icmp_seq=0 ttl=118 time=21.550 ms
    64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=21.256 ms
    64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=21.343 ms
    ^C
    --- 8.8.8.8 ping statistics ---
    3 packets transmitted, 3 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 21.256/21.383/21.550/0.123 ms
  2. Ping from inside a container
    ➜  ~ docker run -it --rm alpine
    / # ping 8.8.8.8
    PING 8.8.8.8 (8.8.8.8): 56 data bytes
    ^C
    --- 8.8.8.8 ping statistics ---
    195 packets transmitted, 0 packets received, 100% packet loss

The internet connection inside the container works, e.g. curling a website. Changing the ping target or the container image does not solve the problem.

On the other side, pinging from inside a container works with Podman and Rancher Desktop. Furthermore, being on an Apple chip seems to be a fundamental part of the issue.

axelys commented 1 year ago

same problem