Resolution
vi check.sh
'#!/usr/bin/env bash'
** Please remove ' ' while copy pasting
echo 'Please give the New JRE Docker Image:'
read JRE_DOCKER_IMAGE
echo '-----------------------------------------------'
echo 'Pulling latest JRE Docker Image'
echo '-----------------------------------------------'
docker pull $JRE_DOCKER_IMAGE
echo '-----------------------------------------------'
echo 'Running the JRE Docker Container'
echo '-----------------------------------------------'
docker run -itd $JRE_DOCKER_IMAGE /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 '-----------------------------------------------'