Unable to connect to an user-defined network

Hello

We have the following setup:

  • main server that hosts a Drone master container and a Drone runner container
  • runner server that only host a Drone runner container

On the runner server we would like to let all the steps communicate with containers launched separately (Docker Compose) and that are connected to their own network.
In order to perform that, I’ve set the environment variable DRONE_RUNNER_NETWORKS to the user-defined Docker network where the other containers are connected only on this server:

$ sudo docker exec -ti drone-runner sh
/ # env
HOSTNAME=a1eec5141e23
SHLVL=1
HOME=/root
GODEBUG=netdns=go
DRONE_PLATFORM_OS=linux
DRONE_RPC_HOST=drone.mycorp.tld
DRONE_PLATFORM_ARCH=amd64
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DRONE_RPC_PROTO=https
DRONE_RUNNER_CAPACITY=14
PWD=/
DRONE_RUNNER_NETWORKS="custom_bridge"
DRONE_RPC_SECRET=xxxxx
DRONE_RUNNER_NAME="drone-runner"      

Howerver when relaunching the pipeline it fails:

<buildname> Error response from daemon: network <network_id> not found

I’ve tried to restart the Drone runner container and dockerd, but that didn’t help.
I’ve also tried to create the same user-defined network on the main server in case the issue was refering to it missing on that other server, but that didn’t help either.
Finally I’ve tried to simulate this from another container that shares the host’s Docker socket as we do for the Drone runner and it works great (I’m able to see the user-defined network). I’m not sure how I could do that from the Droner runner container given that the native Docker CLI is not present.

Thanks for your help and advice.

Hello,

You should be able to pass DRONE_RUNNER_NETWORKS=<name of network> to the agent (or the server if you are not using agents). When Drone spawns containers it will attach all containers to the specified network.
e.g. of a docker compose

drone-runner-docker:
  volumes:
  - '/var/run/docker.sock:/var/run/docker.sock'
  environment:
  - DRONE_RPC_PROTO=http
  - DRONE_RPC_HOST=172.20.0.19
  - DRONE_RPC_SECRET=SECRET
  - DRONE_RUNNER_CAPACITY=2
  - DRONE_RUNNER_NAME=drone-runner-docker
  - DRONE_RUNNER_NETWORKS=droneio_network,another_network
  networks:
  droneio_network:
  another_network:
  ports:
  - '3000'
  restart: always
  image: 'drone/drone-runner-docker:latest'

You can do a ‘docker network ls’ and get the name for the network for containers you want communicating with each other. and use the actual name for the network