def METHOD_NAME():
    """Check if the docker daemon is up and running. This should return a
    docker client if everything is running fine. Else it should exit
    gracefully. The intent is that this function is run before any docker
    operations are invoked"""
    try:
        client = docker.from_env(timeout=180)
        client.ping()
        return client
    except (requests.exceptions.ConnectionError, docker.errors.DockerException) as e:
        logger.critical('Critical Docker error: %s', str(e))
        if 'FileNotFoundError' in str(e) or 'ConnectionRefusedError' in str(e):
            logger.critical('Docker is not installed or the daemon is not '
                            'running.')
        if 'PermissionError' in str(e):
            logger.critical('The user id is not in the docker group.')
        logger.critical('Aborting...')
        sys.exit(1)