1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 23:04:21 +00:00

Add an error message if the connection to the Docker daemon fails

This commit is contained in:
Steffo 2021-09-10 17:55:13 +02:00
parent eb3cf89a99
commit 178a99c23f
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -2,13 +2,19 @@ import enum
import logging
import time
import docker.errors
import docker.models.containers
log = logging.getLogger(__name__)
log.info("Connecting to Docker daemon...")
client: docker.DockerClient = docker.from_env()
log.info("Connection to Docker daemon successful!")
try:
client: docker.DockerClient = docker.from_env()
except docker.errors.DockerException as e:
log.fatal("Could not connect to the Docker daemon!")
raise
else:
log.info("Connection to Docker daemon successful!")
class HealthState(enum.IntEnum):