Connect our Drone CI pipeline containers with other Docker containers
Drone CI launches its pipeline containers in isolated networks to avoid security problems. If we found an scenario where we want to connect Drone containers with other containers already running in our Docker engine, this is what we could do.
1) Create a bridge network in Docker. In my example I use drone as my network name:
`docker network create -d bridge drone`
2) Connect a running container, the one that you want to be connected from Drone containers, to your new network. In this example, my container is named as our_container_name.
`docker network connect drone our_container_name`
3) Launch your Drone Agent runner using the following env variable (Reference: https://docs.drone.io/runner/docker/configuration/reference/drone-runner-networks/):
4) Whenever we want our Drone container to get access to a running container use your container name in your url, for example http://our_container_name. Using names, Docker will perform name resolution and thanks to your shared network Drone containers and your Docker containers will be connected.
In my tests, I tried to use the default Docker bridge named bridge, but it didn’t worked and in any case you may not want to use the default network to avoid external access, so that’s why I chose to create a new bridge network.
This discussion may help you: https://discourse.drone.io/t/drone-docker-agents-on-custom-network/3732
Hope it helps