Skip to content

Commit

Permalink
Handle Docker errors correctly (#196)
Browse files Browse the repository at this point in the history
* Handle Docker errors correctly

docker intercepts errors from requests and returns its own errors, so we actually need to expect a docker error here

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
kaeraali-flutterint and pre-commit-ci[bot] authored Dec 2, 2023
1 parent e9d5649 commit 42e68e2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/molecule_plugins/docker/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ def sanity_checks(self):
log.info("Sanity checks: '%s'", self._name)
try:
import docker
import requests

docker_client = docker.from_env()
docker_client.ping()
except requests.exceptions.ConnectionError:
except docker.errors.DockerException:
msg = (
"Unable to contact the Docker daemon. "
"Please refer to https://docs.docker.com/config/daemon/ "
Expand Down

0 comments on commit 42e68e2

Please sign in to comment.