I have a Node.js project with Testcontainers used for staring Redis and Prostgress for tests.
I want to run these tests as a part of CI. For that purpose, I use an alpine image of Node.js with Docker installed on top of it. I can run tests that don't require Docker there, but if it involves Docker, I get this error from Testcontainers:
No Docker client strategy found
Here is what I get in logs:
2022-05-25T13:09:11.494Z testcontainers DEBUG Found applicable Docker client strategy: UnixSocketStrategy
2022-05-25T13:09:11.531Z testcontainers DEBUG Testing Docker client strategy URI: unix:///var/run/docker.sock
2022-05-25T13:09:11.539Z testcontainers DEBUG No registry auth locator found for registry: "https://index.docker.io/v1/"
2022-05-25T13:09:11.543Z testcontainers WARN Docker daemon is not reachable: Error: connect ENOENT /var/run/docker.sock
2022-05-25T13:09:11.543Z testcontainers WARN Docker client strategy UnixSocketStrategy is not reachable
2022-05-25T13:09:11.544Z testcontainers ERROR Failed to list images: Error: No Docker client strategy found
2022-05-25T13:09:11.544Z testcontainers ERROR Failed to pull image "postgres:14.2-alpine": Error: No Docker client strategy found
The tests run fine when I start them locally.
I haven't found anything in the CodeBuild documentation explaining connecting to the Docker Engine from inside a builder container. I found these instructions in the Testcontainers documentation, but I don't understand how to apply this in AWS Codebuild.
Q: How to run tests that require starting Docker in AWS CodeBuild?
docker --version
which would printDocker version 20.10.16, build aa7e414fdcb23a66e8fabbef0a560ef1769eace5
. Do I need something else? – Premonition