forked from rootless-containers/rootlesskit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-docker.sh
executable file
·33 lines (26 loc) · 994 Bytes
/
integration-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
source $(realpath $(dirname $0))/common.inc.sh
nonloopback="$(hostname -I | awk '{print $1}')"
docker rm -f nginx >/dev/null 2>&1 || true
CURL="curl -fsSL"
set -x
docker run -d --name=nginx -p 8080:80 nginx:alpine
sleep 2
$CURL "http://127.0.0.1:8080"
$CURL "http://${nonloopback}:8080"
docker rm -f nginx
docker run -d --name=nginx -p 127.0.0.1:8080:80 nginx:alpine
sleep 2
$CURL "http://127.0.0.1:8080"
$CURL "http://${nonloopback}:8080" && ( ERROR "should fail"; exit 1 )
docker rm -f nginx
# port driver "implicit" does not support binding on a non-loopback address:
# "Error starting userland proxy: listen tcp4 172.18.0.2:8080: bind: cannot assign requested address."
if [ "$DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER" != "implicit" ]; then
docker run -d --name=nginx -p "${nonloopback}:8080:80" nginx:alpine
sleep 2
$CURL "http://127.0.0.1:8080" && ( ERROR "should fail"; exit 1 )
$CURL "http://${nonloopback}:8080"
docker rm -f nginx
fi
INFO "===== PASSING ====="