in my job I very often setup docker containers that are controlled by a docker-compose file. Often I have to specify credentials in this file, and I don't know how to secure them properly. How to do this?
Here is an example: Consider you want to setup a database with an user jira and a corresponding password, needed for another dockerized application, and you need to specify the password:
version: '3.4'
services:
postgresql:
image: postgres:9.5-alpine
environment:
- 'POSTGRES_USER=jira'
- 'POSTGRES_PASSWORD=PasswordInClearTextSoFar'
networks:
- my_network
networks:
my_network:
driver: bridge
That someonse on the host could see the user is bad, but that "PasswordInClearTextSoFar" is visible is something that really annoys me. I don't know how to fix this.
Is it possible to use here system environment variables in the docker-compose file? if yes, how is this correctly done under a linux system?
How would you secure the credentials
Thanks and greetings