Open robakiewiczj opened 8 months ago
Diagnostic process described below is working forever (last 30 mins) without result (https://docs.docker.com/desktop/troubleshoot/overview/#diagnose)
@robakiewiczj thanks for the report and sorry the diagnostics failed. The next version of DD should have more reliable (and faster) diagnostics. I couldn't reproduce this one locally on WSL 2 with Win 11 and a fresh install of Docker 4.28. It works for me because the DNS server configured in the dockerd container will resolve that name:
> docker.exe run --rm --privileged --pid=host -it justincormack/nsenter1
~ # enter dockerd
root@docker-desktop:/# cat /etc/resolv.conf
# DNS requests are forwarded to the host. DHCP DNS options are ignored.
nameserver 192.168.65.7
If I change my dockerd daemon.json to have
"dns": ["8.8.8.8"]
then I see something similar:
> docker run --rm -it alpine ping host.docker.internal
ping: bad address 'host.docker.internal'
> docker run --rm -it --add-host=host.docker.internal:host-gateway alpine ping host.docker.internal
PING host.docker.internal (192.168.65.254): 56 data bytes
64 bytes from 192.168.65.254: seq=0 ttl=63 time=1.010 ms
This is because the "dns" option is overriding the /etc/resolv.conf. Do you have dns
set in your daemon.json
?
Hi David,
Do you have dns set in your daemon.json?
No, I dont have. Both Windows and Docker Desktop is a fresh installation without any additional customization
Do you have
dns
set in yourdaemon.json
?
No.
Client:
Version: 26.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.27.0-desktop.2
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.29
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.23
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.8.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 61
Running: 46
Paused: 0
Stopped: 15
Images: 61
Server Version: 26.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 5.15.146.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 47.04GiB
Name: docker-desktop
ID:
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: true
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
reproduced issue:
docker run --rm -it alpine sh
ping host.docker.internal
ping: bad address 'host.docker.internal'
same inside wsl2 docker-ce works as expected.
sudo docker run --rm -it alpine sh
ping host.docker.internal -c 1
PING host.docker.internal (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: seq=0 ttl=255 time=0.036 ms
--- host.docker.internal ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.036/0.036/0.036 ms
Restore host.docker.internal on docker desktop requires --add-host=host.docker.internal:host-gateway
docker run --rm -it --add-host=host.docker.internal:host-gateway alpine sh
/ # ping host.docker.internal -c 1
PING host.docker.internal (192.168.65.254): 56 data bytes
64 bytes from 192.168.65.254: seq=0 ttl=63 time=0.872 ms
--- host.docker.internal ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.872/0.872/0.872 ms
or for compose
extra_hosts:
- "host.docker.internal:host-gateway"
Description
Usage example of host.docker.internal variable doesn't work on Docker Desktop without adding additional property --add-host=host.docker.internal:host-gateway
Location: https://docs.docker.com/desktop/networking/
Docker Desktop 4.28.0 (139021) OS: MS Windows 11 Pro (10.0.22621)
Reproduce
--Run the following command to start a simple HTTP server on port 8000. python -m http.server 8000
-- start docker docker run --rm -it alpine sh apk add curl curl http://host.docker.internal:8000 exit
--output / # curl http://host.docker.internal:8000 curl: (6) Could not resolve host: host.docker.internal
After adding --add-host=host.docker.internal:host-gateway connection is properly established
Expected behavior
should work with gateway configuration
docker version
docker info
Diagnostics ID
11111111111
Additional Info
Cant generate diagnostic ID