Merge pull request #155 from FrozenDragoon/dev

Bind lighttpd to only one IP when using "--net=host"
This commit is contained in:
Adam Hill 2017-07-27 10:24:10 -05:00 committed by GitHub
commit 5d2ee76afe
2 changed files with 12 additions and 0 deletions

View File

@ -118,6 +118,17 @@ setup_dnsmasq_hostnames() {
fi
}
setup_lighttpd_bind() {
if [[ "$IMAGE" == 'debian' ]] ; then
# if using '--net=host' only bind lighttpd on $ServerIP
if grep -q "docker" /proc/net/dev ; then #docker (docker0 by default) should only be present on the host system
if ! grep -q "server.bind" /etc/lighttpd/lighttpd.conf ; then # if the declaration is already there, don't add it again
sed -i -E "s/server\.port\s+\=\s+80/server.bind\t\t = \"${ServerIP}\"\nserver.port\t\t = 80/" /etc/lighttpd/lighttpd.conf
fi
fi
fi
}
setup_php_env() {
case $IMAGE in
"debian") setup_php_env_debian ;;

View File

@ -25,6 +25,7 @@ setup_dnsmasq
setup_php_env
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
setup_ipv4_ipv6
setup_lighttpd_bind "$ServerIP" "$IMAGE"
test_configs
test_framework_stubbing
echo "::: Docker start setup complete - beginning s6 services"