-
Notifications
You must be signed in to change notification settings - Fork 20
/
test.sh
executable file
·51 lines (39 loc) · 1.75 KB
/
test.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -e
set -x
echo '{"insecure-registries": ["localhost:5000"]}' | sudo tee /etc/docker/daemon.json
sudo service docker stop
sudo service docker start
docker run --name docker-dind-sshd --privileged -d brthornbury/docker-dind-sshd --storage-driver=overlay
hostIp=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' docker-dind-sshd)
echo $hostIp
python setup.py sdist
pip install dist/*.tar.gz
# Create Test Images
image1="a84b42fbe17b4a87b032c45f3c8c74e3"
mkdir /tmp/${image1}
(cd /tmp/${image1} \
&& echo "FROM alpine" >> ./Dockerfile \
&& echo "RUN touch /etc/${image1}" >> ./Dockerfile \
&& echo "CMD echo out-${image1}" >> ./Dockerfile \
&& docker build -t ${image1} .)
image2="e294fca67f674bda84013057fd48fb62"
mkdir /tmp/${image2}
(cd /tmp/${image2} \
&& echo "FROM alpine" >> ./Dockerfile \
&& echo "RUN touch /etc/${image2}" >> ./Dockerfile \
&& echo "CMD echo out-${image2}" >> ./Dockerfile \
&& docker build -t ${image2} .)
echo "" > ./emptykey
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22 root@${hostIp} 'sh -l -c "docker run "'"${image1}"
failResult1="$?"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22 root@${hostIp} 'sh -l -c "docker run "'"${image2}"
failResult2="$?"
set -e
[ "$failResult1" != "0" ]
[ "$failResult2" != "0" ]
docker-push-ssh --prime-image alpine -i ./emptykey -p 22 root@${hostIp} ${image1}
docker-push-ssh --prime-image alpine -r 5002 -i ./emptykey -p 22 root@${hostIp} ${image2}
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22 root@${hostIp} 'sh -l -c "docker run "'"${image1}"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22 root@${hostIp} 'sh -l -c "docker run "'"${image2}"