Skip to content

Commit 42e68e2

Browse files
Handle Docker errors correctly (#196)
* 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>
1 parent e9d5649 commit 42e68e2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/molecule_plugins/docker/driver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,10 @@ def sanity_checks(self):
239239
log.info("Sanity checks: '%s'", self._name)
240240
try:
241241
import docker
242-
import requests
243242

244243
docker_client = docker.from_env()
245244
docker_client.ping()
246-
except requests.exceptions.ConnectionError:
245+
except docker.errors.DockerException:
247246
msg = (
248247
"Unable to contact the Docker daemon. "
249248
"Please refer to https://docs.docker.com/config/daemon/ "

0 commit comments

Comments
 (0)