Hmm. Having some issues with `./pants publish` and...
# general
n
Hmm. Having some issues with
./pants publish
and
DOCKER_HOST
in our CI environment.
./pants package
is connecting to the custom daemon address specified in
DOCKER_HOST
just fine, but when running
./pants publish
I get "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?".
Copy code
$ echo $DOCKER_HOST
<tcp://dockerdaemon:2375/>

$ ./pants publish ::
04:59:07.04 [INFO] Starting: Building docker image <redacted>:latest.
04:59:18.63 [INFO] Completed: Building docker image <redacted>:latest.
04:59:18.64 [INFO] Built docker image: <redacted>:latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
๐„‚ <redacted>:latest failed.
Unsetting
DOCKER_HOST
, or changing it to something invalid, makes the "Cannot connect to..." error show up even before building. So it seems like it's ignoring the value set in
DOCKER_HOST
for the part where it pushes to the registry.
m
Copy code
[docker]
env_vars = ["DOCKER_HOST"]
on
pants.toml
, I guess?
h
If that fixes it, we should almost certainly add DOCKER_HOST to the default for that option
๐Ÿ™Œ 1
m
it fixed for me 3h ago ๐Ÿ˜Ž
โค๏ธ 1
h
Sweet! @modern-wolf-36228 any interest in submitting a PR? You would simply add default=["DOCKER_HOST"] to the relevant option in docker_options.py
n
Already have it in my pants.toml sadly, still happens ๐Ÿ˜ž
Copy code
[docker]
env_vars = [
    "DOCKER_HOST",
]
h
Note that we should only have it be in the default, we should not hardcode that DOCKER_HOST is always autopopulated. It's important users can override what the value is set to
n
If I remove
env_vars
from
pants.toml
then
./pants package
starts failing too. With
env_vars
only
./pants publish
fails and only after building the image (when pushing to the registry I assume).
h
Hm it looks like the env vars are being set: https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/docker/goals/publish.py You could run with -ldebug to see the argv and env vars that are being used to publish. Or --no-process-execution-local-cleanup and inspect the __run.sh script
n
Will do!
Seems like I'm running a version of Pants (2.8.1rc0) where this fix isn't available: https://github.com/pantsbuild/pants/pull/13669
๐Ÿ‘ 1
h
Good find! Sounds like we should cherry-pick that PR
โœ… 1
โž• 1
c
It does have the
needs-cherrypick
label on itโ€ฆ ๐Ÿ˜‰ but apart from that, Iโ€™d forgot about it already..
๐Ÿ˜† 1
w
@curved-television-6568: if you wouldnโ€™t mind doing the cherry-pick, iโ€™d be happy to do the release
c
Sure thing. I'll do it later tonight. Thanks :)
w
๐Ÿšข
iโ€™ll try to get another 2.8.x prepped in my tonight
๐Ÿ‘ 1
๐Ÿ™Œ 1