How to create docker image with drone when code is modified in bitbucket repository

Hi Team,

I want build new docker image every time when the code is changed in repository. For that how to configure drone. i am not able to find any solution.
Can you please help me in this.

Below is the drone installation docker-compose file and i have tested with sample .drone.yml and it is works fine.

version: ‘2’

services:
drone-server:
image: drone/drone:0.8

ports:
  - 80:8000
  - 9000
volumes:
  - /var/lib/drone:/var/lib/drone/
  - /etc/bitbucket/key.pem:/etc/bitbucket/key.pem
restart: always
environment:
  - DRONE_OPEN=true
  - DRONE_HOST=http://000.000.000.000
  - DRONE_STASH=true
  - DRONE_STASH_GIT_USERNAME=
  - DRONE_STASH_GIT_PASSWORD=
  - DRONE_STASH_CONSUMER_KEY=
  - DRONE_STASH_CONSUMER_RSA=
  - DRONE_STASH_URL=http://bitbucket.xxxxx.xxx:7990/bitbucket
  - DRONE_SECRET=FAD2JFkJEffgMjak6uQqJxKmv3HGD99L5xaz
  - DRONE_HOOK=http://000.000.000.000/hook

drone-agent:
image: drone/agent

command: agent
restart: always
depends_on:
  - drone-server
volumes:
  - /var/run/docker.sock:/var/run/docker.sock
environment:
  - DRONE_SERVER=drone-server:9000
  - DRONE_SECRET=FkvGvSffgMjak6uQqJxKmv3HGD99L5xaz

you would use the docker plugin for this, which handles building and publishing images:
http://plugins.drone.io/drone-plugins/drone-docker/

Thanks for your quick response.
But currently I want build images in my local mechine where drone is running.

Can you please help me in further.

Thanks

Sravan

You can mount the host machine docker socket and interact directly with the docker daemon:
http://docs.drone.io/docker-volumes/

Thanks for your quick response. I will go through your links

Thanks
Sravan

HI

I am facing issue with drone to create docker image. Below are the my file to configure drone and .drone.yml file create new docker image when any changes made in the bitbucket repository

version: ‘2’

services:
drone-server:
image: drone/drone:0.8

ports:
  - 80:8000
  - 9000
volumes:
  - /var/lib/drone:/var/lib/drone/
restart: always
environment:
  - DRONE_ADMIN=sravan
  - DRONE_OPEN=false

- DRONE_ADMIN=sravan

  - DRONE_HOST=http://
  - DRONE_GITHUB=true
  - DRONE_GITHUB_CLIENT=a3exxxxxxxxxxd2a33
  - DRONE_GITHUB_SECRET=5af4ff89c0f13xxxxxxxx4854625
  - DRONE_SECRET=taVfIELINoHSeCtmzGkxxxxxWVq6YwxxxxxjJ1faaNU96nqNuBeVUu

drone-agent:
image: drone/agent:0.8

command: agent
restart: always
depends_on:
  - drone-server
volumes:
  - /var/run/docker.sock:/var/run/docker.sock
environment:
  - DRONE_SERVER=drone-server:9000
  - DRONE_SECRET=taVfIELINoHSfaaNU96nqNuBeVUu

##############################

below is the my sample .drone.yml file

pipeline:
build:
image: ubuntu:14.04
commands:
- docker build -t test123 .
volumes:
- /var/run/docker.sock:/var/run/docker.sock

Throwing "Insufficient privileges to use volumes"

Please help me to fix this

Please search the forum / google for existing topics related to this message https://discourse.drone.io/search?q=Insufficient%20privileges%20to%20use%20volumes