https://pantsbuild.org/ logo
#general
Title
# general
r

rough-camera-14641

05/02/2023, 1:14 AM
Hey All. I'm sure there is a simple answer to this one... We're looking at options for a new test harness using testcontainers to integrate into our CI pipeline. All is working well if I execute the tests using pytest, however I'm receiving the below error when running the same test in pants:
Copy code
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Any tips?
1
e

enough-analyst-54434

05/02/2023, 1:17 AM
Do you have that file present on your machine or is Docker configured to use an alternate communication channel?
r

rough-camera-14641

05/02/2023, 1:18 AM
Just to add that a
pants publish
works as intended.
e

enough-analyst-54434

05/02/2023, 1:19 AM
If you don't have the file presumably there is a docker env var of some sort and Pants blocks most env vars by default; so you'd let the appropriate ones leak with: https://www.pantsbuild.org/docs/reference-test#extra_env_vars
r

rough-camera-14641

05/02/2023, 1:19 AM
Ah yeah good point, I do use Colima on my local
Yep, that must be it. Thanks John, will take a look!
This works...
Copy code
./pants test --test-extra-env-vars="['DOCKER_HOST="unix://$HOME/.colima/docker.sock"']"
Thanks for answering my silly question 🙂
👍 1
3 Views