Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dns-sd(1)を使い、VMware Fusionのホスト側NATインターフェイス(172.16.241.1)を`host.docker.internal.local`としてアドバタイズする
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.internal.docker.host.bonjour</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/dns-sd</string>
<string>-P</string>
<string>host.docker</string>
<string>_http._tcp</string>
<string>local</string>
<string>8888</string>
<string>host.docker.internal.local</string>
<string>172.16.241.1</string>
</array>
<key>LowPriorityIO</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
@norio-nomura

This comment has been minimized.

Copy link
Owner Author

@norio-nomura norio-nomura commented Oct 5, 2018

これを~/Library/LaunchAgents/local.internal.docker.host.bonjour.plistへ置く。

@norio-nomura

This comment has been minimized.

Copy link
Owner Author

@norio-nomura norio-nomura commented Oct 5, 2018

これに合わせて、

$ docker-machine create --driver vmwarefusion --engine-opt dns-search=local default

の様に--engine-opt dns-search=localを使ってコンテナの/etc/resolv/confsearch localを設定すると、Docker for Mac同様にホストIPをhost.docker.internalで解決できる様になる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment