Can the pipeline container share the network with the host

I’m using Drone to run the integration tests for a project which depends on a number of external services (cassandra, kafka, elasticsearch).

Drone runs in a development server where we already have a docker-compose with all those services (accesible at localhost :9042, :9200, etc.). I wonder if there’s a way for the container that runs my tests to access the host network, and thus all services, instead of having to setup separate services in .drone.yml, which have to be initialized from scratch in every build.

This approach is not necessarily recommended but is certainly possible. One option would be to enable trusted mode for your repository (in the drone user interface) and then use host networking mode for pipeline steps that need to interact with the host network.

pipeline:
  build:
    image: foo
+   network_mode: host
4 Likes

Yes, I understand why this is not generally the best idea, but it’s very convenient in our current setup.

That totally did the trick, thanks!

Awesome! Hope it will find a way to docs some day.

Feel free to submit a PR to https://github.com/drone/docs :slight_smile:

This might be a good place to start: https://github.com/drone/docs/blob/master/content/usage/config/networks.md