File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 216216message " Stop containers "
217217docker stop http-echo-tests
218218
219+ message " Check that container is running as user different that the user defined in image"
220+ IMAGE_USER=" $( docker image inspect mendhak/http-https-echo -f ' {{ .ContainerConfig.User }}' ) "
221+ CONTAINER_USER=" $(( IMAGE_USER + 1000000 )) "
222+ docker run -d --name http-echo-tests --rm -u " ${CONTAINER_USER} " -p 8080:8080 mendhak/http-https-echo
223+ sleep 5
224+ curl -s http://localhost:8080 > /dev/null
225+
226+ WHOAMI=" $( docker exec http-echo-tests id -u) "
227+
228+ if [ " $WHOAMI " == " $CONTAINER_USER " ]
229+ then
230+ passed " Running as $CONTAINER_USER user"
231+ else
232+ failed " Not running as $CONTAINER_USER user or failed to start"
233+ exit 1
234+ fi
235+
236+ message " Stop containers "
237+ docker stop http-echo-tests
238+
219239popd
220240rm -rf testarea
You can’t perform that action at this time.
0 commit comments