Let suppose I have an env file with
DB_PW=123
And a docker command that expects
-env MYSQL_ROOT_PASSWORD=123
Is there a way to take that DB_PW from the env file and assign it to MYSL_ROOT_PASSWORD in the command line? (obviously not having to add a line to the env file with the explicit assignment) I have been reading here and there, but I am not sure if it's possible or where this would be documented.
if you're using "--env-file <ENV_FILE>" flag or .env file exists in compose directory then, you can directly call values from .env file by using "${ENV_VAR}" ex: -env MYSQL_ROOT_PASSWORD=${DB_PW} https://docs.docker.com/compose/environment-variables/