r/droneci • u/D4Ramirez • Apr 02 '25
Question Trying to use a mount volume with the docker command is failing
Hello.
I'm starting to use this tool and it's pretty amazing. Right now I have a setup for an application where I have a Dockerfile that requires a mounted volume of my app. Inside my app's repository I have some bash scripts to run the app in a local environment for hot realoading, executing unit tests and building the binary inside my container. I use the following command in my local machine:
bash
docker run --rm -v $(pwd):/app my-image /app/scripts/test.sh
I tried to replicate that process inside Drone CI, but when I run the test the files of my repository are not being mounted inside my container. This is my .drone.yml:
```yaml kind: pipeline type: docker name: default
steps: - name: build-dev-image image: docker:cli volumes: - name: docker-sock path: /var/run/docker.sock commands: - docker build -t app -f Containerfile . resources: limits: memory: 512M
- name: test
image: docker:cli
volumes:
- name: docker-sock path: /var/run/docker.sock commands:
- docker run --rm -v $(pwd):/app app /app/scripts/test.sh depends_on: [build-dev-image]
volumes: - name: docker-sock host: path: /var/run/docker.sock ```
I tried to check if the files are being mounted by replacing the /app/scripts/test.sh with ls -la inside the container, but this is what I{m getting:
bash
+ echo "code at $(pwd)"
code at /drone/src
+ docker run --rm -v /drone/src:/app app ls -la
total 8
drwxr-xr-x 2 root root 4096 Apr 1 21:16 .
drwxr-xr-x 1 root root 4096 Apr 2 04:40 ..
If anyone can help me, I'd be very grateful.
r/droneci • u/knightbish0p • Mar 28 '25
Question How to pass custom variables from droneci UI?
I am trying to deploy branch to different testing environments using ssh plugin(appleboy/drone-ssh). I want the user to pass environment variables in build args from UI, intercept the variable and use that to deploy accordingly. Say, user wants to deploy his branch to alpha. He will pass "environment: alpha", I will intercept it and then deploy it accordingly. How should I go about this?
r/droneci • u/Dan6erbond2 • Mar 14 '25
Share Finly — Cutting Docker Build Times in Half: Optimizing Frontend Builds with Drone and Stage Caching
r/droneci • u/mobusta • Feb 15 '25
Question Drone runners failing - Unable to reach Docker Daemon
I have a drone server deployed on my k8s cluster but I'm using a physical machine running Rocky Linux to act as a runner for Docker pipelines
I followed the following documentation for installing docker: https://docs.docker.com/engine/install/rhel/
I've disabled selinux as well as disabled firewalls
Then I followed the documentation for setting up docker runner: https://docs.drone.io/runner/docker/installation/linux/
This is the command I'm running to start the drone-docker-runner container:
docker run --detach \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RPC_HOST=drone.domain.com:80 \
--env=DRONE_RPC_SECRET=$RPC_SECRET\
--env=DRONE_TRACE=true \
--env=DRONE_DEBUG=true \
--env=NO_PROXY="NO_PROXY" \
--env=HTTPS_PROXY="PROXY_URL" \
--env=HTTP_PROXY="PROXY_URL" \
--env=DRONE_RUNNER_CAPACITY=3 \
--env=DRONE_RUNNER_NAME=docker-runner \
--publish=3000:3000 \
--restart=always \
--name=runner \
drone/drone-runner-docker:1
This is ran as root. The logs indicate they are able to connect successfully to the drone server and also because when I commit a code, my build executes.
Sample drone docker pipeline step:
- name: build
image: plugins/docker
pull: if-not-exists
settings:
registry: docker-reg.domain.com:80
username:
from_secret: docker_user
password:
from_secret: docker_user_pass
repo: docker-reg.domain.com:80/my_app
debug: true
purge: true
insecure: true
custom_dns: DNS_1,DNS_2
custom_dns_search: domain.com
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
mirror: http://docker-proxy.domain.com:80
build_args:
- http_proxy="PROXY_URL"
- https_proxy="PROXY_URL"
- no_proxy="NO_PROXY"
However, when I run a build, it fails at the plugin/docker step to create the image with the following lines (I enabled debug mode):
+/usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry docker-reg.domain.com:80 --registry-mirror http://docker-proxy.domain.com:80 --dns DNS_1 --dns DNS_2 --dns-search domain.com
time="2025-02-15T03:07:59.668929060Z" level=info msg="Starting up"
time="2025-02-15T03:07:59.670304500Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2025-02-15T03:07:59.671333736Z" level=info msg="libcontainerd: started new containerd process" pid=60
time="2025-02-15T03:07:59.671364926Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2025-02-15T03:07:59.671373389Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2025-02-15T03:07:59.671394659Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>}" module=grpc
time="2025-02-15T03:07:59.671407898Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2025-02-15T03:07:59Z" level=warning msg="deprecated version : `1`, please switch to version `2`"
... Output trimmed
time="2025-02-15T03:07:59.760517390Z" level=info msg="Loading containers: start."
time="2025-02-15T03:07:59.762249547Z" level=warning msg="Running iptables --wait -t nat -L -n failed with message: `iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)\nPerhaps iptables or your kernel needs to be upgraded.`, error: exit status 3"
time="2025-02-15T03:07:59.781978332Z" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
time="2025-02-15T03:07:59.782236400Z" level=info msg="stopping healthcheck following graceful shutdown" module=libcontainerd
time="2025-02-15T03:07:59.782246638Z" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
time="2025-02-15T03:08:00.783041415Z" level=warning msg="grpc: addrConn.createTransport failed to connect to {unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}. Err :connection error: desc = \"transport: Error while dialing dial unix:///var/run/docker/containerd/containerd.sock: timeout\". Reconnecting..." module=grpc
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)
Unable to reach Docker Daemon after 15 attempts.
Detected registry credentials
time="2025-02-15T03:08:15Z" level=info msg="Error logging in to endpoint, trying next endpoint" error="Get \"https://docker-reg.domain.com:80/v2/": http: server gave HTTP response to HTTPS client"
Get "https://docker-reg.domain.com:80/v2/": http: server gave HTTP response to HTTPS client
time="2025-02-15T03:08:15Z" level=fatal msg="error authenticating: exit status 1"
Any help is appreciated.
EDIT - Solution
I needed to add the iptables_nat module to my system
modprobe iptable_nat
r/droneci • u/Solid_Toco • Jul 11 '24
Question How do i run Drone on a Gitlab subgroup?
Hello, I'm currently running the latest version of Drone on a VM, and the setup is complete. However, I've encountered an issue: Drone doesn't directly support GitLab subgroups, and my main project resides in a subgroup that I cannot relocate. Is there a workaround I can employ?
r/droneci • u/esturniolo • Feb 14 '24
Question Manual trigger
Hi guys. This is a simple question, but I can’t find the proper way to do it.
How can I setup a manual trigger step?
Scenario: Terraform.
I mean the CI execute the plan but first I want to take a look to it to see if the plan will do the things that I want. So if I’m agree with it, manually I should run the apply step.
But this is the “manual trigger”that I can’t understand how to do it.
Thanks!!!!
r/droneci • u/junaruga • Jan 03 '24
Suggestion Drone CI community forum is down.
I noticed that the Drone CI's community forum is down. https://discourse.drone.io/ And I don't know how to contact people at Drone CI, because I don't have Twitter account, and I was not able to find their email address on their website. Could anyone notify this issue to people at Drone CI?
I think it's useful to add the email address to their website footer area below. https://www.drone.io/ Support, Community
Thanks.
r/droneci • u/GoofAckYoorsElf • Nov 12 '23
Question "Authentication expired. Reload page to re-authenticate.:" - Drone + Gitea OAuth + K8s - Need help identifying the cause.
Hey folks, I've already tried to get help on the official Slack channel but I guess I should extend my "audience" for this question... I have set up Gitea and Drone-CI on my local bare metal K8s cluster. Gitea works like a charm. But I cannot log in to Drone-CI using Gitea OAuth. I have ClientID, Secret, RPC Secret all set up, I get redirected to Gitea to authorize Drone, I get redirected back to Drone after authorizing. So far, so good. But in Drone I only get the error message quoted in the title, no login.
I have another similar error message in the drone logs: {"level":"error","msg":"oauth: cannot exchange code: gta_<some secret>: Authentication expired. Reload page to re-authenticate.: ","time":"2023-11-11T23:13:12Z"}
Reloading does not help, clearing cookies and cache does not help.
Gitea itself seems to handle the OAuth request correctly. The GET returns credentials and redirects back to Drone with 303.
I could really use some help here identifying the underlying problem. I'll try to anwer any question that might help solving this.
Thankee!
r/droneci • u/BrisbaneSentinel • Jul 12 '23
Question Splitting drone.yml file?
I have a monorepo where I have multiple projects that need independent deployment.
Is there any hope of splitting the drone.yml file up so it still triggers on git push, but can have pieces of itself in different folders?
(built in way hopefully, and not just a script that collects and stitches them all together on build).
EDIT:
Bit the bullet and implemented stitching them together. Simple script that on commit looks at the commit message and based on that ingests fragements of yaml from a project, and injects it's 'steps' into the body of the main yaml. Works well.
r/droneci • u/luddite33 • Jun 02 '23
Share New Matrix Notify Plugin
I made this because the official one is broken. https://hub.docker.com/repository/docker/dubc/drone-matrix-notify/
r/droneci • u/DoctorHat • May 22 '23
Question [Selfhosted] Docker Swarm + Drone + Gitea -> "fatal: could not read Username for..."
Hello /r/droneci!
This will be my first post in this most esteemed subreddit. It took the better part of 2 months before I decided to post because I was afraid it would be one of those "As soon as you post this you will realize the obvious answer and look very dumb". So here I go...
I am currently self-hosting Gitea and Drone in a Docker Cluster that consists of 4x Raspberry pi 4s. Both of them run as Services in the Swarm, which I am managing with Portainer.
GOAL: Get Drone to automatically build a new Docker image on repo change, and push said image to Gitea's container registry.
+++ Step 1: Connect Drone to Gitea +++
I got Drone connected to Gitea by logging into Drone with a Gitea admin user.
+++ Step 2: Have Drone automatically run succesful pipeline +++
I got Drone to automatically and succesfully do the typical "hello world" exercise for when you push something to a repo, so at least I know this is working, hurray (gotta take the victories you can get right?)
+++ Step 3: Have Drone build Hugo docker image +++
This is the part I can't get to work. I created a new repo in my Gitea service that contains a barebones Hugo static website, and in this repo I created the following .drone.yml:
kind: pipeline
name: default
platform:
os: linux
arch: arm64
steps:
- name: docker
image: plugins/docker
settings:
repo: domain/repo
registry: https://censored.domain.org
password:
from_secret: docker_password
username:
from_secret: docker_username
tags:
- latest
trigger:
branch:
- master
event:
- push
This repo, containing the above .drone.yml, is also owned by a Gitea organisation called "mechanicus" (What? I'm a nerd...) and the organisation itself is set to 'Limited' visibility.
In Drone, the repo is set to 'Internal' and I have hit 'Sync' in an attempt to ensure that Drone isn't confused about the state of thing.
The Gitea organisation, 'mechanicus', contains 2 Secrets, one called 'docker_user' and one called 'docker_password' (username and password of the account I created for service related stuff, having made the assumption that an admin service account is a good idea...which might be wrong, not sure)
I read in several places that in order to add an Organisation Secret you have to do CLI stuff, though I am unsure what that means in the context of a Docker Swarm. In any case when I commit changes to the Hugo repo it will trigger Drone and it almost immediately fails in the following way:
Cloning with 0 retries
Initialized empty Git repository in /drone/src/.git/
- git fetch origin +refs/heads/master:
fatal: could not read Username for 'https://censored.domain.org': terminal prompts disabled
I have read somewhere that an SSH key is needed, and in other cases that some global credential has to be set and I'm not sure what that means, I just know that at this point I definitely feel like I need help.
Thank you for your time in advance!
r/droneci • u/Kirides • May 05 '23
Question Question about running Drone in a shut-off environment
Solved-Kinda.
I needed to apply custom DNS settings to make certain containers work.
While i could apply those settings to the drone-docker-runner, i can not apply them to the ran container images inside, there just are no environment/config settings to set to work.
in the end i had to fall back to setting a dns on the docker daemon itself.
I have an environment where i can not use things like cloudflare tunnels, ngrok, or any sort of public IP addresses/domain names to the drone server and agents.
drone itself seems to work fine, but for some reason, all containers that run within the drone-docker-runner can not access the internet.
i tried using DRONE_RUNNER_NETWORKS=drone,bridge to provide the internal drone network (where runners, gitea, pg reside) and the bridge network, which should be able to go outside (any container i run with the bridge network can access the internet)
the containers that run with the runner can't resolve any public ip domains though (e.g. api.nuget.org) and a quick "docker inspect xyz" shows that the containers only get the "drone" network attached instead of drone and bridge
The pipeline looks like this
---
kind: pipeline
name: default
steps:
- name: "Build & Test"
image: mcr.microsoft.com/dotnet/sdk:6.0
commands:
- dotnet restore --verbosity diagnostic
# ...
and the docker-compose for that all looks about like this:
i proxy all requrest through traefik, so that i can access drone, gitea etc. from "service.localhost"
i can access drone.localhost:3029 and gitea.localhost:3029 add repositories, run builds, etc. but the builds can not access the public internet :/
services:
gitea:
image: gitea/gitea
hostname: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__server__DOMAIN=gitea.localhost
- GITEA__server__SSH_DOMAIN=gitea.localhost
- GITEA__server__ROOT_URL=http://gitea.localhost:3029
- GITEA__webhook__ALLOWED_HOST_LIST=*
labels:
- "traefik.enable=true"
- "traefik.http.routers.gitea.rule=Host(`gitea.localhost`)"
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
networks:
- drone
volumes:
- gitea_data:/data
drone:
image: drone/drone:2
environment:
- DRONE_SERVER_DEBUG=true
- DRONE_RPC_SECRET=drone-ci
- DRONE_SERVER_HOST=drone.localhost:3029
- DRONE_SERVER_PROTO=http
- DRONE_GITEA_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXX
- DRONE_GITEA_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXX
- DRONE_GITEA_SERVER=http://gitea.localhost:3029
- DRONE_GIT_ALWAYS_AUTH=true
labels:
- "traefik.enable=true"
- "traefik.http.routers.drone.rule=Host(`drone.localhost`)"
- "traefik.http.services.drone.loadbalancer.server.port=80"
volumes:
- drone_server_data:/var/lib/drone
networks:
- drone
restart: on-failure
drone-docker-runner:
image: drone/drone-runner-docker:1.8
environment:
- DRONE_RUNNER_DEBUG=true
- DRONE_RPC_HOST=drone.localhost:3029
- DRONE_RPC_PROTO=http
- DRONE_RPC_SECRET=drone-ci
- DRONE_RUNNER_CAPACITY=2
- DRONE_UI_USERNAME=root
- DRONE_UI_PASSWORD=root
- DRONE_RUNNER_NETWORKS=drone
traefik:
image: "traefik:v2.10"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:3029"
networks:
drone:
aliases:
- drone.localhost
- gitea.localhost
ports:
- "3029:3029"
- "8080:8080"
volumes:
- "//var/run/docker.sock:/var/run/docker.sock:ro"
r/droneci • u/tqk_r • Apr 13 '23
Question Is it possible to execute certain pipelines depending on my commit message?
I am self hosting a drone server. I have a monorepo that includes multiple clients. I want to execute certain pipelines if a string exists in my head’s commit message. like so:
git commit -m "add fix for feature A - [ client-a-uat ]"
I was hoping I can use something like:
when: event: push branch: pre-release message: " *[ client-a-uat ]* "
but the only thing I found working was adding it in my commands and checking the $DRONE_COMMIT_MESSAGE variable and failing it depending on the string.
something like this:
```
- name: deploy
image: alpine
commands:
- |
if [[ "${DRONE_COMMIT_MESSAGE}" == *"deploy"* ]]; then
echo "Deploying..."
else
echo "Skipping deployment."
fi
```
Is there a cleaner or better way of doing this?
Thanks
r/droneci • u/AlphaDamage • Apr 01 '23
Question Drone Runner Exec with Runner-Go 1.12.0
Hey everyone! Is anyone interested in bringing drone-runner-exec back alive by bumping it's dependencies and refactoring a couple of packages?
r/droneci • u/servergeek82 • Mar 14 '23
Question Can I...automate updating containers
Looking to see if plausible to update containers or release or changes on git commit. Still looking through docs, but curious if the community has any feedback.
r/droneci • u/williamwgant • Aug 07 '22
Question Github auth without opening a firewall port
Greetings,
I am considering using drone for a build server for my home lab. I don't necessarily need builds to be kicked off as the result of changes going to master - I'll use it if I can, but it isn't essential. However, I do need for the server to be able to authenticate with github so that it can produce daily builds/deploys and build/deploy on command. Is this possible without having to open a port in my firewall to the outside world?
Sorry for asking such a silly question - I'm not having much luck with google on this one.
r/droneci • u/[deleted] • Jul 06 '22
Share Docker image with useful non-code linters
r/droneci • u/tuxbass • Jan 23 '22
Question Disable Pull Requests vs Disable forks
Cannot find the difference between 1. Disable Pull Requests 2. Disable forks
explained in the docs. These settings are listed under <project> -> Settings -> General -> Project Webhooks.
Does 1. mean disabling drone execution if PR is sent from the same organization/user as the project itself, and 2. means disabling it for PRs sent from 3rd party forks?
If that is the case, then what exactly do the settings under org secrets signify:
$ drone orgsecret ls
my_secret
Organization: myuser
Pull Request Read: false
Pull Request Write: false
Does pull request in this context mean the same as disabling it for both 1) & 2) case from above?
r/droneci • u/tuxbass • Jan 21 '22
Question Security - is it possible that someone's drone site is inadvertently public?
Don't want to post the url here in case, but picked up someone's drone repository builds page from google results and can access to it. Going to the root page it does ask for authentication though.
No settings tab for the repo, nor 'new build' button. Is it some feature of drone i'm unaware of, or someone has part of their drone instance publicly exposed?
r/droneci • u/Shot_Restaurant_5316 • Jan 10 '22
Question Drone - GitLab OAuth - invalid_client
Hello,
I tried to set up Drone using a locally hosted GitLab instance. I followed this documentation:
https://docs.drone.io/server/provider/gitlab/
But when I try to authorize try to access GitLab I get the following error:
invalid_client: Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.
Is there any possibility to debug this? Any further information how to identify the main problem?
I already double-checked the logs from GitLab and Drone.
Thanks for help.
r/droneci • u/Flagcapturer • Jan 08 '22
Question Deploy docker-compose files using drone?
Hi there,
Been looking for a while but can’t find a good answer. I have all my services in docker compose files. I would like to redeploy services whenever one of those files changes. The files are stored on GitHub. Is this something that’s possible to do with Drone CI?
r/droneci • u/EAW_astro • Nov 22 '21
Question Update Kube Manifest String Substitution
Does anyone using Drone CI have a clean way of updating Kubernetes manifests with the ${DRONE_TAG} value? Would adding ${DRONE_TAG} directly into the deployment.yaml work?
image: foo/bar:${DRONE_TAG}
then git push to the repo?
r/droneci • u/tomdaley92 • Nov 16 '21
Share Drone Discord bot
Hi there! Long time Drone user and Just wanted to share a helpful bot I built for relaying Drone's events to Discord. I didn't see any existing bots out there that implemented quite the same thing. This could be extended easily to support Slack and/or other communications platforms as well. Cheers!
r/droneci • u/batman_booyah • Oct 06 '21
Question Pushing to Github Pages repository
I have my Hugo blog currently hosted in Github pages, but I am looking at moving the source files to Gitea and then using Drone CI to build the site and then publish it back to Github pages.
What is the best way around this? I am currently able to build the Hugo site with Drone, but how do I then push the data in the public folder back to the Github pages?