Bash scripts exits on entering docker container

Viewed 1798

Im trying to create a bash script for setting up docker and an application on a fresh server.

pretty fresh to bash itself but i think ive got the just

heres a snippet where my issue lies -

#
docker run -d --name application -p 80:80 -d  tutum/apache-php
docker run -d -p 3306:3306 --name=database --
env="MYSQL_ROOT_PASSWORD=password1" mysql:latest
echo "--------------------------------------------------------------------"
echo "Docker is all done - run docker ps -a to see all created 
containers!"
echo "--------------------------------------------------------------------"
echo "Moving onto installing application into app container!"
echo "--------------------------------------------------------------------"
docker exec -it application bash

apt-get update & apt-get install git & cd /var/www/html
#

on the line - docker exec -it application bash

It enters the container as expected but the bash script then stops because of this meaning the following commands after don't run

Is there anyway I can get around this? I don't think there is but in case there are any bash wizards out there!

Any help appreciated!

2 Answers
Related