[proxy] rewrite /etc/hosts from outside the container

Avoids problems when container user is non-root. Added a test for this
and the --no-rewrite-hosts flag.
This commit is contained in:
Paul Bellamy committed 2015-08-06 13:14:18 +01:00
1 parent 3180c67151
commit f55655216f
6 files changed
+172 -117

No files matched your search

+6
View File
@@ -1131,8 +1131,14 @@ launch_proxy() {
# when launching the weaveproxy container.
docker_client_args $DOCKER_CLIENT_ARGS
proxy_args "$@"
HOSTS_PATH=$(docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint /bin/sh \
$EXEC_IMAGE -c 'docker inspect -f {{.HostsPath}} $(hostname)')
CONTAINERS_PATH="$(dirname $(dirname "$HOSTS_PATH"))"
PROXY_CONTAINER=$(docker run --privileged -d --name=$PROXY_CONTAINER_NAME --net=host \
$PROXY_VOLUMES \
-v "$CONTAINERS_PATH":"$CONTAINERS_PATH" \
-v /var/run:/var/run \
-v /proc:/hostproc \
-e PROCFS=/hostproc \