1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-08-24 00:11:55 +00:00

fix: Don't remove pytest container when running with host network mode

When the container runs with host networking instead of the default bridge, the `$HOSTNAME` / `/etc/hostname` reflects that of the host instead of the container ID , which causes the pytest container to get removed accidentally.

Using a container name instead we can more reliably target the container to avoid removing it, should we need to run with host networking instead.
This commit is contained in:
polarathene
2021-12-31 22:12:25 +13:00
parent e748d53a1f
commit b2b4c71997
2 changed files with 9 additions and 7 deletions

View File

@@ -18,8 +18,8 @@ docker build -t nginx-proxy-tester -f "${DIR}/requirements/Dockerfile-nginx-prox
# run the nginx-proxy-tester container setting the correct value for the working dir in order for
# docker-compose to work properly when run from within that container.
exec docker run --rm -it \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "${DIR}:${DIR}" \
--workdir "${DIR}" \
nginx-proxy-tester "${ARGS[@]}"
exec docker run --rm -it --name "nginx-proxy-pytest" \
--volume "/var/run/docker.sock:/var/run/docker.sock" \
--volume "${DIR}:${DIR}" \
--workdir "${DIR}" \
nginx-proxy-tester "${ARGS[@]}"