Test if we can construct a docker client and confirm that we can communicate with it. This is intended to help in debug connection issues, and also for use in tests. For example, you might implement a testthat skip test that skips if stevedore::docker_available() returns FALSE to conditionally use stevedore/docker within tests.

docker_available(..., verbose = FALSE)

Arguments

...

Passed through to docker_client (e.g., api_version, host).

verbose

Logical, indicating if information should be printed about failures to connect. If FALSE (the default) the function runs silently.

Value

Logical scalar, TRUE if

docker_client(...) would succeed.

Details

Reasons for failure to connect might include:

  • You do not have a docker daemon running

  • You have docker installed but the socket in a non-standard place and have not adjusted environment variables accordingly

  • You do not have permission to write to the docker socket

  • You are on windows and the required python packages to get everything working there are not present or configured correctly

  • There are problems arranging verification over https/tls.

If versose is TRUE then some diagnostic information will be printed.

Examples

# Is docker available on your system?
stevedore::docker_available()
#> Detected API version '1.41' is above max version '1.39'; downgrading
#> [1] TRUE