This commit is contained in:
leonzhang77 2018-02-27 01:50:12 +00:00
Родитель ce4a5800ca 4b16593dfc
Коммит 5f7d209bbc
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -13,6 +13,14 @@ test_Dockerfile(){
cat inspect.json cat inspect.json
# Check SSH Ports # Check SSH Ports
# Only 2 ports allowed where one is always 2222
testPORTS=$(jq .[].Config.ExposedPorts inspect.json | grep -o ":" | wc -w)
if [ ${testPORTS} -gt 2 ]; then
echo "${testPORTS}"
echo "FAILED - Too many ports are exposed!!!"
exit 1
fi
testSSH=$(jq .[].Config.ExposedPorts inspect.json | grep 2222) testSSH=$(jq .[].Config.ExposedPorts inspect.json | grep 2222)
if [ -z "${testSSH}" ]; then if [ -z "${testSSH}" ]; then
echo "FAILED - PORT 2222 isn't opened, SSH isn't working!!!" echo "FAILED - PORT 2222 isn't opened, SSH isn't working!!!"
@ -47,6 +55,16 @@ test_Dockerfile(){
else else
echo "PASSED - Great, there is no VOLUME lines." echo "PASSED - Great, there is no VOLUME lines."
fi fi
# Check User
testUSER=$(jq .[].Config.User inspect.json)
if test "${testUSER}" != '""' ; then
echo "${testUSER}"
echo "FAILED - These USER lines should not be existed!!!"
exit 1
else
echo "PASSED - Great, there is no USER lines."
fi
} }
echo "Docker: "${DOCKER_IMAGE_NAME}"/"${DOCKER_IMAGE_VERSION} echo "Docker: "${DOCKER_IMAGE_NAME}"/"${DOCKER_IMAGE_VERSION}