Unable to connect to application database from docker

Hello Team,

I am using metabase docker version to build viz backed up by AWS RDS database. I am unable to use docker run command using mysql environment variables and receiving attached error

Docker command used-
docker run -p 3000:3000 -e "MB_DB_TYPE=mysql" -e B_DB_DBNAME=dbname" -e "MB_DB_PORT=3306" -e "MB_DB_USER=username" -e "MB_DB_PASS=pwd" -e "MB_DB_HOST=hostname" docker-img-name

FWIW, other environment variables like JVM, anonymous tracking etc are working as expected.

Any help is appreciated!

Thanks,
Shruthi

Hi @sramesh
It looks like you are using encryption. You need to define the secret to be able to connect.
https://www.metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
But it's difficult to tell, so include the full log from startup to failure - not as a screenshot.

hi @flamber thanks for the quick response. I did add MB_ENCRYPTION_SECRET_KEY=secret env variable as well which resulted in the similar error . attached the complete docker log

@sramesh The secret doesn't match, so that's the problem. Please read the documentation again.

@flamber when you say secrets doesn't match is it the DB pwd and Secret key you are referring to? I confirm that both the values are same .

In addition, i need to override connection string set in admin panel manually by passing them as an env variables in docker run. Is that supposed to not work?

@sramesh Have you ever used encryption at rest as documented here. Yes or No?
https://www.metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html

If yes, then that can only be defined via an environment variable - there's no setting in the GUI.
And if the secret does not match what you used previously, then there's no way of restoring that, as noted in the documentation.

There's no setting in the GUI for any of the MB_DB_* environment variables. Those are for the application database, not the data sources. Two completely different things. You cannot define your data sources via environment variables.