Replies: 1 comment 1 reply
-
I would need to see your full Dockerfile and entrypoint script for Drone to see why it's not working. I looked up the drone dockerfile itself but it didn't clue me into anything useful. Make sure in your entrypoint script you pass execution, which is how a "script plus command" works in entrypoint+cmd. See my example of how that works here: https://youtu.be/C1GE07UEFDo Also, I've used Drone in the past, and much prefer my CI to be the one built into my code storage, which is way less work to maintain, with many more features. See my recent video on my opinions of CI/CD solutions and why I prefer GitHub Actions. |
Beta Was this translation helpful? Give feedback.
-
Hello,
first of all everything mentioned here is for docker swarm production environment therefore I would really appreciate to point out my mistakes if you see any bad practices and also I'm seeking for production grade solutions for the problem mentioned in the title.
As we all know using docker secrets for official images that support them is pretty straight forward in your stack yaml file define your secrets and use them in environment variables with a "_FILE" at the end of it. almost every famous database is using this convention. So as far as I know It won't be visible to anyone except PID1
Now there are lots of images out there that don't support this convention. two of them that I encountered recently is Docker official registry and Drone CI from Harness.
How official images support docker secrets
I studied couple of official database Dockerfiles (MySQL and PostgreSQL) to see how they support secrets and generally its a script like this running in their entrypoint script file :
Docker Secrets for official registry image
for Docker private registry image I created another image using
registry:2
as the base image and inserted this script before it's default entrypoint script and then replaced it to support docker secrets for aws s3 credentials to setup s3 storage for the registry.entrypoint.sh
Dockerfile
also it is worth mentioning that I installed bash to be able to run the bash script I extracted from database images.
Drone CI
I couldn't figure out how this image works and where is it's entrypoint script to replace it. I tried to build an image with drone image as its base and run the script from a separate file before the original entrypoint script but it just doesn't work.
non-working Dockerfile
so I come up with another solution that works but it is even more hacky and spits out credentials to container logs on start-up which I believe is a bad thing. The solution was to define another entrypoint for it in the stack yaml file.
P.S. Drone CI developers are not interested in supporting docker swarm so that's not an option unfortunately.
So what is the correct way
All of this feels really hacky to me. I was wondering if there is a better way to handle this situation.
if not, I would like to hear any suggestions for the second one where using
cat
in entrypoint script is printing credentials into container logs.Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions