Closed 128keaton closed 3 years ago
I've got the same problem on Mac OS Mojave 10.14. docker system prune --volumes
as mentioned here: #2705 didn't work either.
I have exactly the same problem. It makes networking between services impossible to set up on the Mac. I add my vote for a quick fix, as this is a showstopper in many Mac dev projects.
@PeterBengtson I had to move back to using Vagrant while the rest of the team happy enjoys Docker because of this issue.
Has there been any progress on this issue?
I have exactly the same problem. on Mac OS Mojave.
Same problem on OSX Mojave (10.14) using Version 18.06.1-ce-mac73 (26764)
However, docker.for.mac.host.internal
does resolve to the correct IP.
I'm using this with latest stable Docker and docker-compose with NFS on the latest macos and it works fine.. I'll retest today to be sure.
Hi @PeterBengtson @128keaton, can you please let us know what is the status here? Thanks a lot.
Situation resolved - it was a question of using the right IP for resolving in the nginx proxy conf. tis 6 nov. 2018 kl. 11:10 skrev Gregory Reshetniak <notifications@github.com
:
Hi @PeterBengtson https://github.com/PeterBengtson @128keaton https://github.com/128keaton, can you please let us know what is the status here? Thanks a lot.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/for-mac/issues/2965#issuecomment-436199643, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAPObSEz54HEAe6cWVxnWqXPpuUel1qks5usWAHgaJpZM4UXAjw .
Not sure how nginx factors in here. I have checked and can confirm host.docker.internal is not being resolved on my 18.06 which prevents me from using docker
On Tue, 6 Nov 2018, 13:09 Peter Bengtson <notifications@github.com wrote:
Situation resolved - it was a question of using the right IP for resolving in the nginx proxy conf. tis 6 nov. 2018 kl. 11:10 skrev Gregory Reshetniak < notifications@github.com
:
Hi @PeterBengtson https://github.com/PeterBengtson @128keaton https://github.com/128keaton, can you please let us know what is the status here? Thanks a lot.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/for-mac/issues/2965#issuecomment-436199643, or mute the thread < https://github.com/notifications/unsubscribe-auth/AAAPObSEz54HEAe6cWVxnWqXPpuUel1qks5usWAHgaJpZM4UXAjw
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/docker/for-mac/issues/2965#issuecomment-436230833, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRlBanMhEa-3ytEvzRJ3HdTl-Twme_sks5usXvmgaJpZM4UXAjw .
have a look at https://github.com/qoomon/docker-host as a workaround
I also had this issue. Reinstalling with the latest stable version (18.06.1-ce-mac73
) caused the host.docker.internal
DNS entry to resolve to the host machine in my containers. I am also running macOS 10.14 (Mojave).
My original installation was pretty old (I'd applied updates, but never reinstalled anew) that had some dns haxin' lingering as described in this issue. Maybe it was related?
Reinstall fixed it for me. Thanks!
I have the same problem on macOS (Mojave) with docker (18.09) and also (18.06.1-ce).
host.docker.internal
can not be accessed from docker container.
A ping to host.docker.internal
from the docker container works:
docker exec -it <id of your container> /bin/bash
and then
ping host.docker.internal
resolves to:
PING host.docker.internal (192.168.65.2) 56(84) bytes of data
But
docker run --rm alpine nslookup host.docker.internal
returns
nslookup: can't resolve '(null)': Name does not resolve
Name: host.docker.internal
Address 1: 192.168.65.2
Same issue here as @sonerd
$ docker run --rm alpine nslookup host.docker.internal
nslookup: can't resolve '(null)': Name does not resolve
Name: host.docker.internal
Address 1: 192.168.65.2
$ docker run --rm alpine ping host.docker.internal
PING host.docker.internal (192.168.65.2): 56 data bytes
64 bytes from 192.168.65.2: seq=0 ttl=37 time=0.257 ms
64 bytes from 192.168.65.2: seq=1 ttl=37 time=0.569 ms
64 bytes from 192.168.65.2: seq=2 ttl=37 time=0.561 ms
64 bytes from 192.168.65.2: seq=3 ttl=37 time=0.562 ms
^C
--- host.docker.internal ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.257/0.487/0.569 ms
Docker version 18.09.0, build 4d60db4
I found this in /etc/hosts
172.16.238.1 docker.for.lin.host.internal 172.16.238.1 docker.for.lin.localhost
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
comment.
Stale issues will be closed after an additional 30d of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
I have the same problem in macos mojave 10.14.5 (18F132) and Docker version 19.03.0-rc2, build f97efcc:
`> $ docker run --rm alpine nslookup host.docker.internal
nslookup: can't resolve '(null)': Name does not resolve nslookup: can't resolve 'host.docker.internal': Name does not resolve`
I seem to have this issue as well. What should I do?... With docker engine 19.03.1
This issue has been up/alive for over a year. That, combined with the lack of documentation on Docker's FS implementation on mac (sucks!) really makes you think if docker is the right move anymore.
I can't understand why this simple issue cannot be solved.... for now it seems that I just need to use 192.168.65.2
and it works, instead of using host.docker.internal
or something like docker.for.mac.localhost
...
Having the same exact issue. Docker Desktop 2.1.0.1 (37199) stable.
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:18:17 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:17:52 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683```
Same here, worked around with bridge network
Any update? I have same issue and It's over the year! 🤚
$ docker-compose run -e DISPLAY=$MY_HOST_IP:0 myapp // works well
$ dokcer-compose run -e DISPLAY=host.docker.internal:0 myapp // cannot connect error
and ping
works well on container inside.
root@d02807ed1072:/# ping host.docker.internal
PING host.docker.internal (192.168.65.2) 56(84) bytes of data.
64 bytes from 192.168.65.2: icmp_seq=1 ttl=37 time=1.59 ms
64 bytes from 192.168.65.2: icmp_seq=2 ttl=37 time=0.452 ms
with Docker version 19.03.1, build 74b1e89
seems like passing host.docker.internal
into container as environment is considered as a litteral word not as a resolve target. cause ping
works in container bash.
Still having the same issue on
Just a note for folks in this issue: I just had a user who thought they were using Docker Desktop (which provides host.docker.internal) but they were actually accessing an old docker-machine running in Docker Toolbox via the environment variable DOCKER_HOST, and I don't believe Docker Toolbox ever provides host.docker.internal. So... you shouldn't need or have DOCKER _HOST if you're using Docker Desktop, and check carefully that all vestiges of Docker Toolbox are gone.
Having same issue with:
MacOS 10.14.6 Docker Version 19.03.5 Docker Desktop: Version 2.1.0.5 (40693) Docker Machine: 0.16.2
It's been more than a year! You've got to be kidding!
After removing custom dns entries from my docker advanced daemon settings host.docker.internal
does finally resolve again.
After removing custom dns entries from my docker advanced daemon settings
host.docker.internal
does finally resolve again.
Thanks this fixed the problem
If you need a custom dns try to add the first ip as dns. So if the subnet is 192.168.65.0/24 under Resources->Network then the dns is probably 192.168.65.1
Example with google dns:
{
"dns": [ "8.8.8.8", "192.168.65.1"]
}
Maybe adding the docker dns may also fix the problem, can somebody try this?
Same issues.
How do you do this?
After removing custom dns entries from my docker advanced daemon settings
host.docker.internal
does finally resolve again.
I've been running into this issue as well, when trying to use NFS for filesystem mounts. No resolution, tried anything suggested in this issue so far, short of completely uninstalling and reinstalling Docker for Mac (on Catalina, 10.15.3).
Well that's embarrassing... I spent 30 minutes on this, and finally re-read my error message:
ERROR: for drupal Cannot create container for service drupal: error resolving passed in nfs address: lookup addr=host.docker.internal: no such host
ERROR: Encountered errors while bringing up the project.
The problem was I had copied and pasted the config from a gist or blog post to get NFS configured in my docker-compose file, and it had the format:
o: addr=addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
So someone must've fat-fingered that in whatever post/example I was reading. I deleted the extra =addr
, and now I can get connected.
Going into the preferences and removing this from the dns
entry from the docker engine configuration fixed this issue on Mojave 10.14.6.
Running docker container exec -it container sh
and then once in the docker container running: nslookup host.docker.internal
returns:
Server: 192.168.65.1
Address: 192.168.65.1:53
Non-authoritative answer:
Name: host.docker.internal
Address: 192.168.65.2
** server can't find host.docker.internal: NXDOMAIN
On the docker container my /etc/hosts
file looks like this:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 eb0aec82ae7e
No reference to host.docker.internal anywhere. Any thoughts? Running Docker for Mac on macOS Catalina 10.15.1.
docker version
output:
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:22:34 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:29:19 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
@chasen-bettinger it is from the docker dns, in your case 192.168.65.1
# cat /etc/resolv.conf
# This file is included on the metadata iso
nameserver 192.168.65.1
So if the dns is not set to the internal docker dns, the hostname host.docker.internal
couldn't be found
@chasen-bettinger it is from the docker dns, in your case
192.168.65.1
# cat /etc/resolv.conf # This file is included on the metadata iso nameserver 192.168.65.1
So if the dns is not set to the internal docker dns, the hostname
host.docker.internal
couldn't be found
How do you set the DNS to the internal docker DNS? I'm confused mostly because the way the documentation is written, it seems like it should work out of the box.
The default with no dns is in the docker config should use the default docker dns. If you add other dns servers in the config you probably also need to add the default as the first (only the first 2 are used normally).
You're nslookup host.docker.internal
returns the ip 192.168.65.2
of the internal dns for host.docker.internal, so what's the problem?
I have solved in Docker version 19.03.12 and MacOS Catalina 10.15.7
I found "kubernetes.docker.internal"
I can't understand why this simple issue cannot be solved.... for now it seems that I just need to use
192.168.65.2
and it works, instead of usinghost.docker.internal
or something likedocker.for.mac.localhost
...
Use ip works for me. thanks
Hmm. still broken. when --dns=10.10.10.10 \ --dns-search=somedomain \
I've noticed kubernetes.docker.internal
was set in my /etc/hosts
file by Docker Desktop.
...
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
127.0.0.1 host.docker.internal # (NOTE) I added this
# End of section
...
That seemed to work in my case where I wanted containers to contact my localhost services, whilst allowing my client to access services via host.docker.internal
like a website.
I have a stock docker for mac install. I'm trying to talk to my host's http server. I'm following the advice from the documentation here: https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
but:
$ docker run --rm alpine nslookup host.docker.internal
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
069a56d6d07f: Pull complete
Digest: sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be
Status: Downloaded newer image for alpine:latest
Server: 192.168.64.1
Address: 192.168.64.1:53
** server can't find host.docker.internal: NXDOMAIN
** server can't find host.docker.internal: NXDOMAIN
Why doesn't this work? Has it truly not worked since 2018?
docker info
Still works for me. Not using a VPN or something? Here is my info
$ docker run --rm alpine nslookup host.docker.internal
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
ba3557a56b15: Pull complete
Digest: sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be
Status: Downloaded newer image for alpine:latest
Server: 192.168.65.1
Address: 192.168.65.1:53
Non-authoritative answer:
*** Can't find host.docker.internal: No answer
Non-authoritative answer:
Name: host.docker.internal
Address: 192.168.65.2
``` $ docker info Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Build with BuildKit (Docker Inc., v0.5.1-docker) scan: Docker Scan (Docker Inc., v0.5.0) Server: Containers: 99 Running: 1 Paused: 0 Stopped: 98 Images: 2326 Server Version: 20.10.2 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff init version: de40ad0 Security Options: seccomp Profile: default Kernel Version: 4.19.121-linuxkit Operating System: Docker Desktop OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 3.847GiB Name: docker-desktop ID: 77HL:4PZ7:HNKM:HVWM:SCLE:OS7U:Z5SO:UPED:VTSX:J5D2:GRYM:H4DK Docker Root Dir: /var/lib/docker Debug Mode: true File Descriptors: 42 Goroutines: 46 System Time: 2021-02-25T12:24:24.2661933Z EventsListeners: 3 HTTP Proxy: gateway.docker.internal:3128 HTTPS Proxy: gateway.docker.internal:3129 Registry: https://index.docker.io/v1/ Labels: Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false ```
Docker Engine v20.10.2
No, I don't have any VPN or other exotic network setup, am using default DNS settings, no surprising docker config options, just pretty stock Docker for Mac.
I was also having this issue. Can't say about for all platforms, but I can confirm this issue is fixed in latest release for Apple silicon https://docs.docker.com/docker-for-mac/apple-silicon/#fixes-since-the-apple-silicon-preview-7
Thanks for the report. There was a recent bug fix in Docker Desktop 3.4.0 which should ensure that host.docker.internal
resolves properly. I'll close this issue now but if it still doesn't work on 3.4.0, please upload a fresh set of diagnostics, quote the ID here and ping me. I'll take a look at the logs / re-open the ticket if necessary. Thanks!
@djs55 im on latest mac osx (intel) with latest docker and docker desktop freshly installed , doesn't help followed every single advice here only directly using ip worked
after more research seems: host.docker.internal works if running docker command with --add-host=host.docker.internal:host-gateway
@nahum-litvin-hs Could you share a repro example? Maybe there's something in the container configuration that's a bit different. Also please upload diagnostics and quote the ID so I can take a look at the logs. Thanks!
Expected behavior
host.docker.internal to resolve properly
Actual behavior
host.docker.internal does not resolve to anything.
Information
Diagnostic logs
Steps to reproduce the behavior
(simple demo)
docker run --rm alpine nslookup host.docker.internal
(use in dev)
Running docker-compose up with this configuration results in:
ERROR: for php Cannot create container for service php: error resolving passed in nfs address: lookup addr=host.docker.internal: no such host
I have tried rebooting and resetting Docker. I'd rather not update to 10.13.