Hello guys, I’m trying to setup a database in docker but I’d like to hide the passwords for it with secrets.
My setup to create the containers is with stack in Portainer. Everything is running on a Synology NAS.
This is my configuration
version: '3.7'
services:
mariadb:
image: jc21/mariadb-aria
network_mode: "bridge"
container_name: mariadb
environment:
#MYSQL_ROOT_PASSWORD: "npm" # use secret instead
MYSQL_ROOT_PASSWORD__FILE: /run/secrets/db_root_pwd
MYSQL_DATABASE: "npm"
MYSQL_USER: "npm"
#MYSQL_PASSWORD: "npm" # use secret instead
MYSQL_PASSWORD__FILE: /run/secrets/mysql_pwd
volumes:
- /volume1/docker/sql:/var/lib/mysql
secrets:
- db_root_pwd
- mysql_pwd
secrets:
db_root_pwd:
file: ./db_root_pwd.txt
mysql_pwd:
file: ./mysql_pwd.txt
When I deploy the stack I get the error in the image.
But I can’t figure out what’s the solution for this. Both files db_root_pwd.txt and mysql_pwd.txt are already created in the container folder /volume1/docker/sql.
Thanks for your help.