After building the image I am executing the below command to containerize the docker image:
sudo docker run -d -p 8080:80 --env-file /home/test/localwork/0014-test/dockerBuildScripts/scripts/env_variables.list test:1.0
I have a bash script that sets the database credentials in a file:
#!/bin/bash
echo "SetEnv dbname ${dbname}" >> /etc/apache2/conf-enabled/environment.conf
echo "SetEnv dbuser ${dbuser}" >> /etc/apache2/conf-enabled/environment.conf
echo "SetEnv dbpass ${dbpass}" >> /etc/apache2/conf-enabled/environment.conf
echo "SetEnv dbhost ${dbhost}" >> /etc/apache2/conf-enabled/environment.conf
echo "SetEnv dbport ${dbport}" >> /etc/apache2/conf-enabled/environment.conf
I specifically want to run this file during or after the docker run within the docker since I am creating the environment variables during the docker run and using it in the above bash script.
Update : In the dockerfile I already have the CMD command :
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
How can I execute the above bash script with this CMD already being present?