You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello!
I'm trying to build a docker container and for that I defined a number of build args for it so data like a DB connection string is secured in the bitbucket repository per deployment (Test, Stage, Production). I noticed that the variables are not substituted.
Take this simplified version:
docker build -t test:dev-1 -f ./Dockerfile --build-arg DATABASE_URL=$CI_DB_URL .
Hi @Sebastian Hens,
Welcome to the community.
Would it be possible for you to confirm if you've declared the variable DATABASE_URL as ARG in your Dockerfile?
For example:
ARG DATABASE_URL
Regards,
Mark C
Hi @Mark C
thanks for your responds.
Yes I can confirm that. Something I also tried was writting the variable values into a .env file and copy that file with the other project files into the Dockerfile. After building the image I can confirm that in the .env file also just $CI_DB_URL is written and not the actual value.
echo "DATABASE_URL=$CI_DB_URL" >> .env
The above code line works when I use a not secured variable in bitbucket for CI_DB_URL but not if it is a secure variable.
Regards,
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sebastian Hens
I actually tried following this KB on essentially doing a similar example where I'm passing a secured variable to a Docker container.
Although Pipelines didn't print the secured variable value on my Pipelines build logs, I'm able to use it in a Docker container within Pipelines while cloning a repository.
This means the secured variable should work as expected.
Could you try to use different environment variable names and see how it goes?
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.