Browse code

docker-py: use host-network for nested build of docker-py

When building this image docker-in-docker, the DNS in the environment
may not be usable for the build-container, causing resolution to fail:

```
02:35:31 W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg Temporary failure resolving 'deb.debian.org'
```

This patch detects if we're building from within a container, and if
so, skips creating a networking namespace for the build by using
`--network=host`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3c15cea650e356f11550e435efa79bea4be88504)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/07/16 19:01:55
Showing 1 changed files
... ...
@@ -37,6 +37,7 @@ source hack/make/.integration-test-helpers
37 37
 		(
38 38
 			[ -n "${TESTDEBUG}" ] && set -x
39 39
 			[ -z "${TESTDEBUG}" ] && build_opts="--quiet"
40
+			[ -f /.dockerenv ] || build_opts="${build_opts} --network=host"
40 41
 			exec docker build ${build_opts} -t ${docker_py_image} -f tests/Dockerfile "https://github.com/docker/docker-py.git#${DOCKER_PY_COMMIT}"
41 42
 		)
42 43
 	fi