Docker DNS resolved to localhost => failure


I’m running Drone+Gittea with docker to support a tutorial about Agile Dev/CI/CD. I’m using the following docker-compose.yml file:

When starting the stack with docker-compose up (on a mac), everything is correct. I create an user on Gittea, add a repository, and push some demo code to the repository.

Then, I log into Drone, and activate it for this repository. First issue, the webhook is set to localhost:8000, which will obviously fail when Gittea will try to send a message to this address. By changing it manually to drone-server:8000, the webhook is nicely triggered and the build starts when doing some changes in the repo.

However, the build process tries to clone localhost:3000, instead of gittea:3000.

+ git init
Initialized empty Git repository in /drone/src/localhost/re18/agile-tutorial/.git/
+ git remote add origin http://localhost:3000/re18/agile-tutorial.git
+ git fetch --no-tags origin +refs/heads/master:
fatal: unable to access 'http://localhost:3000/re18/agile-tutorial.git/': Failed to connect to localhost port 3000: Connection refused

As I never mention “localhost” in my docker-compose file, it looks like I’m missing something. I changed the drone containers to run the alpine versions, start a shell inside it, and the containers can ping the others using the right DNS, e.g.,

azrael:agile-tutorial mosser$ docker exec -it continuous-integration_drone-agent_1 /bin/sh
/ # ping gittea
PING gittea ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.118 ms
--- gittea ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.118/0.162/0.181 ms
/ # ping drone-server
PING drone-server ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.105 ms
64 bytes from seq=1 ttl=64 time=0.181 ms
--- drone-server ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.105/0.143/0.181 ms  

=> Am I missing something in Drone configuration? Why is drone resolving to localhost instead of using the DNS given as environment variable inside the docker-compose.yml ?