How to trigger build when running Drone locally?


Thanks for the next response.

My docker-compose.yml from doc is:

    image: drone/drone:0.5
      - 80:8000
      - ./drone:/var/lib/drone/
    restart: always
      - DRONE_OPEN=true
      - DRONE_GITHUB=true

    image: drone/drone:0.5
    command: agent
    restart: always
    depends_on: [ drone-server ]
      - /var/run/docker.sock:/var/run/docker.sock
      - DRONE_SERVER=ws://drone-server:8000/ws/broker

My docker ps is:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
xxxxxxxxxxxx        drone/drone:0.5     "/drone agent"      .... ago         Up ...          8000/tcp               drone_drone-agent_1
yyyyyyyyyyyy        drone/drone:0.5     "/drone server"     ... ago         Up ...>8000/tcp   drone_drone-server_1

My question is : How to trigger a build for the repo xxxx/yyyy?

I try docker exec -it yyy /drone, I show the help, but impossible to trigger :confused:

How to trigger a build for the repo xxxx/yyyy?

When you activate a repository in the drone user interface, drone adds post-commit hooks to your repository in GitHub (or Bitbucket, etc). When you push to your repository, GitHub uses the webhook to trigger a build in Drone.

So one triggers a Drone build by pushing code to the repository.

Thanks for your answer.

But actually, I just test drone on my computer (the address is

But I want to force build with a command because the hooks doesn’t work.

(eg: old drone start xxx/yyy)

This is a fake project^^

Please note there is no way to trigger a new build outside of webhooks. Drone is built and optimized to work with webhooks.

You can use a service like ngrok to expose your local drone instance to github. Ngrok will tunnel traffic from its servers to your laptop. See

You can also attempt to manually curl the drone server and send the GitHub payload. You will need to accurately re-construct the GitHub message, including headers and payload, and webhook url with token, which you can find in the GitHub user interface.

curl -X POST --data @payload.json \
	-H "Content-Type: application/json" \
	-H "X-GitHub-Delivery: 55c50d00-c223-11e6-934e-724510b231d7" \
	-H "X-GitHub-Event: push" \

The above command is what I use locally when testing.

Alternatively if you do not need the drone user interface, you can run builds directly from the command line without a drone server, using the drone exec command. See

1 Like

Big thanks, I’ve just used ngork now.

BUT… are-you shure that there’s no commad-line :frowning:

Yes, I am sure. There is no command to launch a new build like this (ie fetch HEAD from GitHub). There are commands to launch new builds for commits that already exist in the Drone database. I do not believe, however, this is going to solve your issue.

There is a command to re-start an existing build:

drone build start foo/bar 1

There is a command to re-start an existing build with a new build number (good for nighty jobs):

drone build start --fork foo/bar 1

There is a command to run a build locally from the command line and write the results to your console. This is intended for locally testing your yaml configuration, and does not contact the drone server

drone exec
1 Like

Thanks for all!

Sorry for my english syntaxe. :wink: