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>
This commit is contained in:
Sebastiaan van Stijn 2019-07-16 12:01:55 +02:00
parent ba8f4c7994
commit 3c15cea650
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -37,6 +37,7 @@ source hack/make/.integration-test-helpers
( (
[ -n "${TESTDEBUG}" ] && set -x [ -n "${TESTDEBUG}" ] && set -x
[ -z "${TESTDEBUG}" ] && build_opts="--quiet" [ -z "${TESTDEBUG}" ] && build_opts="--quiet"
[ -f /.dockerenv ] || build_opts="${build_opts} --network=host"
exec docker build ${build_opts} -t ${docker_py_image} -f tests/Dockerfile "https://github.com/docker/docker-py.git#${DOCKER_PY_COMMIT}" exec docker build ${build_opts} -t ${docker_py_image} -f tests/Dockerfile "https://github.com/docker/docker-py.git#${DOCKER_PY_COMMIT}"
) )
fi fi