Follow these steps, it shouldn't go wrong :
- First go ahead and create a file called
template.yml, this file is basically going to be your
docker-compose.yml, with you environment variables.
- Now create a file called 'env.sh' , your environment variables are going to be in this.
- Now run the below code in a .sh file.
source env.sh; rm -rf docker-compose.yml; envsubst < "template.yml" > "docker-compose.yml";
This will create a new docker-compose.yml file with all the right values of environment.
Here is a sample template.yml file given below:
command: /bin/sh -c "chmod 777 /tmp/start; /tmp/start"
Here is a sample 'env.sh' file given below:
export ORACLE_DB_PORT=<port to be exposed>
Hope this helps :)
Want to get better in docker and it's related topics ? Try out docker training course.