From 9c5470ca8757eb3be0071c417fc3852b2d6113ec Mon Sep 17 00:00:00 2001 From: David Scott Date: Mon, 15 Feb 2016 15:02:31 +0000 Subject: [PATCH] Use IP rather than socket9p for the docker socket Before this patch, docker would only listen on 0.0.0.0:2375 if running on Hyper-V. This patch makes it listen there on all hypervisors. In the case of xhyve, it will listen on the host internal vmnet network or the virtual slirp network. We should aim to replace this with a socket- based transport instead. Signed-off-by: David Scott --- alpine/packages/docker/etc/init.d/docker | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/alpine/packages/docker/etc/init.d/docker b/alpine/packages/docker/etc/init.d/docker index 19231e9c5..973eb47dc 100755 --- a/alpine/packages/docker/etc/init.d/docker +++ b/alpine/packages/docker/etc/init.d/docker @@ -6,15 +6,22 @@ command="${DOCKER_BINARY:-/usr/bin/docker}" pidfile="/run/docker.pid" +# Start with networking on both Mac and Hyper-V, but in +# future change this to use a hypervisor socket. +DOCKER_OPTS="${DOCKER_OPTS} -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock" + +if cat /proc/cmdline | grep -q 'com.docker.driverDir' +then + DRIVER="$(cat /proc/cmdline | sed -e 's/.*com.docker.driverDir="//' -e 's/".*//')" + INET=$(ifconfig eth0 2> /dev/null | grep 'inet addr' | cut -f 2 -d ":" | cut -f 1 -d " ") + echo $INET > "/Mac/$DRIVER/ip" +fi + if cat /proc/cmdline | grep -q 'com.docker.database' then DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')" CONFIG_FILE="/Database/branch/master/ro/${DATABASE}/etc/docker/daemon.json" [ -s ${CONFIG_FILE} ] && DOCKER_OPTS="${DOCKER_OPTS} --config-file ${CONFIG_FILE}" -else - # If there is no database and we run on Hyper-V start daemon - # with networking for now. This will change in the future! - [ -d /sys/bus/vmbus ] && DOCKER_OPTS="${DOCKER_OPTS} -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock" fi