Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Docker Network Type

Justin McGee March 6, 2021

Hey there,

Firstly, this is great - I love that we can run our pipelines on premise now.

With that said, I have a strange request. I need to be able to configure the build container that runs to use --net=host, as opposed to bridge.

Because it doesn't seem possible to configure the docker daemon to use host networking by default, is there a way I can configure bitbucket pipelines to launch my container with --host=net ?

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
lassian
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2021

Hi Justin,


Thanks for the feedback, currently we are aiming to first be feature parity with our cloud runner as this would be an extra feature we may allow for self hosted runners in the future.

In the meantime can you please help us understand your use case some more as to why you would to use host mode networking?

Kind Regards,
Nathan Burrell

Justin McGee March 7, 2021

Hey mate,

So a bit of a strange one. We use Slurm (wrapped in AWS Parallel Cluster) HPC to run jobs.

To run a job on our HPC Cluster, we run a command i.e. "srun hostname" which will run the "hostname" command on a random node in our cluster.

The node that runs the job needs to communicate back to the machine that initiated the request over TCP, and because docker essentially NAT's and we can't mass port-forward ports to the container as we need to be able to run multiple pipelines at the same time (and if we just forward a bucket load of ports additional containers will fail to launch), we need the container that we run for the build process in host mode so the node running the job can TCP directly back to the container, if that makes sense :)

Hope that makes sense?

I'm still tyring to come up with a workaround but changing the mode of the containers that are launched from the runner is the path of least resistance (at least for me!).

Like # people like this
Luis November 2, 2021

How can a self hosted runner use the host network when running the containerized step? ( use case, running a VPN network in the host and using curl)

 

docker container run –network host --name
lassian
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 2, 2021

Hi Luis,

You can add a custom dind daemon to your step following these instructions and spin up containers inside of that via your build script using host networking. 

https://support.atlassian.com/bitbucket-cloud/docs/configure-your-runner-in-bitbucket-pipelines-yml/#Custom-docker-in-docker-image

In the future we are looking to provide a non docker runtime that gives direct access to the host aswell to allow you to run scripts on the host allowing them access to the hosts network adapters aswell.

Kind Regards,
Nathan

TAGS
AUG Leaders

Atlassian Community Events