Resolution
vi check.sh
#!/usr/bin/env bash
JRE_VERSION=$1
echo '-----------------------------------------------'
echo 'Pulling latest JRE Docker Image'
echo '-----------------------------------------------'
docker pull XXXXXXXXXXXXXXXXXXXXXXXXXX.$JRE_VERSION
echo '-----------------------------------------------'
echo 'Running the JRE Docker Container'
echo '-----------------------------------------------'
docker run -itd XXXXXXXXXXXXXXXXXXXXXXXXXX.$JRE_VERSION /bin/bash
CONTAINER_ID=$(docker ps | awk 'NR > 1 {print $1}')
echo '-----------------------------------------------'
echo 'Checking all the ENV'
echo '-----------------------------------------------'
docker exec $CONTAINER_ID env
echo '-----------------------------------------------'
echo 'JAVA Version'
echo '-----------------------------------------------'
docker exec $CONTAINER_ID bash -c "java -version"
echo '-----------------------------------------------'
echo 'Deleting all running containers'
echo '-----------------------------------------------'
docker rm -f docker ps -a -q
echo '-----------------------------------------------'
echo 'Deleting all Docker Image'
echo '-----------------------------------------------'
docker rmi $(docker images -a -q)
echo '-----------------------------------------------'
No comments:
Post a Comment