Keep docker container running

In this article let’s discuss about Keep docker container running. Let’s go through the following methods without any delay.

Method 1:

//Check if the container is running
docker ps -a

docker container stop {container-id}

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

# to keep the container running and not exit directly
set -x
while $1
do
    echo "Press [CTRL+C] to stop.."
    sleep 5
    echo "My second and third argument is $2 & $3"
done

Hope the above solution works.

Realted Posts : How to get powers