Create a docker-compose.yml file
Then in an .env file, in the same directory, you can define your environment specific values.
DO NOT CHECK THIS FILE INTO VERSION CONTROL!!!!
With the .env file in the same directory as your docker-compose.yml file, Docker Compose will substitute the values in your environment variables with the corresponding values in the .env file that specific for each environment. This allows your docker-compose.yml file to remain consistent without the possibility of potentially exposing sensitive information through your docker-compose.yml file.
NOTE: It is recommended that you use a secrets management solution like Hashicorp’s Vault to manage sensitive information like credentials.