Tried to configure the drone server and runner locally using localhost but the runner cannot ping the server

i tried to do it in localhost

server
docker run
–volume=/var/lib/drone:/data
–env=DRONE_GITHUB_CLIENT_ID=6bf45dfd211c16111b84
–env=DRONE_GITHUB_CLIENT_SECRET=070fc6469280eca0601784f603ada7db4df41faa
–env=DRONE_RPC_SECRET=2c44c6658b577199210dc7b193f11d96
–env=DRONE_SERVER_HOST=localhost
–env=DRONE_SERVER_PROTO=https
–publish=80:80
–publish=443:443
–restart=always
–detach=true
–name=drone
drone/drone:2

runner

docker run --detach
–volume=/var/run/docker.sock:/var/run/docker.sock
–env=DRONE_RPC_PROTO=https
–env=DRONE_RPC_HOST=localhost
–env=DRONE_RPC_SECRET=2c44c6658b577199210dc7b193f11d96
–env=DRONE_RUNNER_CAPACITY=2
–env=DRONE_RUNNER_NAME=my-first-runner
–publish=3000:3000
–restart=always
–name=runner
drone/drone-runner-docker:1

The reason this does not work is because container networks are completely isolated which means the server and runner are on completely separate networks. This means localhost refers to the network inside the runner container; the server is not running inside the runner container which is why you cannot use localhost to connect.

If you want to run the server and runner containers on the same machine, and have them communicate, you need to use docker networking:
https://docs.docker.com/config/containers/container-networking/

We also provide a docker-compose file that you can use as reference, but you would still need an understanding of docker networking in order to modify to meet your needs:
https://github.com/harness/drone/blob/master/docker/compose/drone-github/docker-compose.yml

thank you for your response. I used ngrok for configuring runner and server in the local machine. now it is running fine and runner is able to ping the server