beta.blog

Author Archive

Testcontainers: Could not find a valid Docker environment. Please see logs and check configuration

by on Oct.09, 2024, under News

On macOS we recently had an issue when firing up Testcontainers:

Could not find a valid Docker environment. Please see logs and check configuration

Usually they’d require us to have a file /var/run/docker.sock so the library can connect to it. This will work fine on Linux but on macOS this file might not exist. We may inspect the docker context with the command docker context inspect giving us the proper directory of the docker.sock file, in our case it was located in /Users/USER/.docker/run/docker.sock

In order to fix the testcontainers issue, we may now either adjust the file ~/.testcontainers.properties and change the docker.host property to the proper path. Alternatively, we might as well just create a soft link to the proper directory sudo ln -s /Users/USER/.docker/run/docker.sock /var/run/docker.sock

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!