Secure credentials handling on Docker in build step
Completed
Hi
We have a build step that needs a username and password to be able to connect to another server. This build step needs to run in a docker container since it needs a specific image and installs some packages for testing.
What is the proper way of sending creds to a docker container in a build step since config, system and env parameters aren't sent to the container?
Adding them as export to the args of the container shows them as clear text in the build logs.
Thanks
Please sign in to leave a comment.
Hi Mats,
TeamCity passes environmental variables from the build configuration to the docker container, but not from the agent. You should be able to use %env.your_var_name% in your script.
You can then configure specs for this parameter so that it is not displayed as plain-text in logs. Edit such a parameter, click edit in the "Specs" field, select type:Password and display:Hidden For instance:
As a result, such a parameter will be hidden with asterisks in the build log:
The above log snippet stands for a simple command-line build step executed in a docker container. Contents of the script are as follows:
Best regards,
Mikhail Efremov
Looks like I somehow lost the contents of the script while posting the above reply, my apologies.