mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 11:44:44 +00:00
Add a dnsfix service
Test to see if we can reach the DNS server which we get via DHCP. If not fall back to Google public DNS. Some users on OSX seem to get this situation with xhyve, see https://github.com/docker/pinata/issues/551 Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
This commit is contained in:
parent
8e0a1bf006
commit
1238340091
@ -36,6 +36,7 @@ COPY packages/automount/etc /etc/
|
||||
COPY packages/9pinit/etc /etc/
|
||||
COPY packages/ntp15m/etc /etc/
|
||||
COPY packages/binfmt_misc/etc /etc/
|
||||
COPY packages/dnsfix/etc /etc/
|
||||
|
||||
RUN \
|
||||
rc-update add swap boot && \
|
||||
@ -68,6 +69,7 @@ RUN \
|
||||
rc-update add automount boot && \
|
||||
rc-update add diagnostics default && \
|
||||
rc-update add binfmt_misc sysinit && \
|
||||
rc-update add dnsfix boot && \
|
||||
ln -s /bin/busybox /init
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
|
18
alpine/packages/dnsfix/etc/init.d/dnsfix
Executable file
18
alpine/packages/dnsfix/etc/init.d/dnsfix
Executable file
@ -0,0 +1,18 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
# A few users have reported not being able to access the nameserver on OSX
|
||||
# If a lookup fails, fall back to Google public nameserver
|
||||
|
||||
depend()
|
||||
{
|
||||
after networking
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Testing DNS resolution"
|
||||
|
||||
dig www.docker.com 2>&1 > /dev/null || printf "nameserver 8.8.8.8\nnameserver 8.8.4.4\n" > /etc/resolv.conf
|
||||
|
||||
eend $? "DNS fix failed"
|
||||
}
|
Loading…
Reference in New Issue
Block a user