How to check if Docker is running


To check if Docker is running:

docker info

To check using an if statement:

if docker info > /dev/null 2>&1; then
  echo 'Docker is running'
fi

To check using a one-line logical operator:

docker info > /dev/null 2>&1 && echo 'Docker is running'


Please support this site and join our Discord!