Hi all, I'm trying to migrate to Pants but I've hi...
# general
a
Hi all, I'm trying to migrate to Pants but I've hit a bit of a problem. We have a dependency in our stack that we can't pin the version of (yet). I tried various things and then came across Docker Environments in 2.15. Unfortunately I'm getting the following error on
pants test ::
Copy code
20:23:27.94 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal
  in Run Pytest - (environment:local_docker, tests/test_config_test.py)

Exception: Failed to obtain version from local Docker: error trying to connect: Permission denied (os error 13)
I am able to run all docker commands without
sudo
pants.toml:
Copy code
[environments-preview.names]
local_docker = "//:local_docker"

[docker]
env_vars = [
  "DOCKER_HOST"
]
BUILD:
Copy code
__defaults__(all=dict(environment="local_docker"))

docker_environment(
  name="local_docker",
  platform="linux_x86_64",
  image="ubuntu:20.04",
)
Is anyone able to help?
b
@witty-crayon-22786 may be a good person to help you re Environments
w
@acoustic-garden-40182: have you used the
docker_image
target type before successfully, and is that why you have
DOCKER_HOST
passed through in the
[docker]
section?
if so, this might be related to https://github.com/pantsbuild/pants/issues/18187
a
@witty-crayon-22786 Thanks for the reply. I've not used the
docker_image
target type before, but I created a simple "Hello, World!" example in my repo and was able to do
pants run docker_example
successfully if I passed through
DOCKER_HOST
. Passing through
DOCKER_CONFIG
doesn't change anything.
w
got it. so without
DOCKER_HOST
things didn’t work? then yea, it’s probably #18187. sorry about that. it should be a quick fix, but we haven’t gotten to it yet
a
Thanks for confirming. If you can point me in the right direction I'm happy to take a crack at a PR for the issue.
w
i investigated this a bit today: can you check out https://github.com/pantsbuild/pants/issues/18187#issuecomment-1462950061 and confirm that setting
--no-pantsd
gets you further on this? if so, i can get a patch cherry-picked to
2.15.x
tomorrow.
a
That works perfectly now, thank you so much!
w
great: i’ll get a patch out. thanks!