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

cold-branch-54016

03/20/2023, 4:28 PM
What is the network mode a container is started with when I use a
docker_environment
for my tests? I am trying to connect to something running on my localhost but I am getting a
ConnectionTimeout
. Am I able to change the network settings for my
docker_enviroments
?
e

enough-analyst-54434

03/20/2023, 4:43 PM
From my phone: https://github.com/pantsbuild/pants/blob/300c4426c4cc86220b8a9b4d58424e8e65ed9c4d/src/rust/engine/process_execution/docker/src/docker.rs#L731-L759 So it looks like no explicit network config. I'm looking up the bollard defaults...
https://docs.rs/bollard/latest/bollard/container/struct.Config.html So there is a network config we default there but I'm not finding the defaults of interest. At any rate, that's where you look for these answers at base. Someone else may have better high level knowledge.
c

cold-branch-54016

03/20/2023, 4:58 PM
The only option in there that could be interesting is network_disabled but that should default to
False
(my rust knowledge is limited though). I think the option I am looking for is networkmode, but it looks like it can only be set at build time? At least it is on the
BuildImageOptions
struct which is currently not used in the pants repo as far as I can see.
The
networkmode
has also no default value so I assume the default of Docker might be used which should be
bridge
.
Should I create an issue for this? I think I figured out what changes to make, but I am not sure how this should be exposed as a configuration to the users ( I assume it should be more generic). I would also be willing to contribute this if the scope isn’t to big.
e

enough-analyst-54434

03/21/2023, 12:53 AM
If you have a nice repro case, that would be best - but even if that is hard to package up - if you can describe the issue in detail, an issue would be great as would your help solving the issue.
3 Views