docker: if container was launched with a tty start bash otherwise loop forever to keep the container going

This commit is contained in:
Joshua Tauberer 2014-05-01 22:16:14 -04:00
parent 7999eae857
commit 16c0a9d342
1 changed files with 19 additions and 2 deletions

View File

@ -8,5 +8,22 @@ service opendkim start
service nginx start
service php-fastcgi start
echo "Your Mail-in-a-Box is running."
bash
if [ -t 0 ]
then
# This is an interactive shell. You get a command prompt within
# the container.
#
# You get here by running 'docker run -i -t'.
echo "Welcome to your Mail-in-a-Box."
bash
else
# This is a non-interactive shell. It loops forever to prevent
# the docker container from stopping.
#
# You get here by omitting '-t' from the docker run arguments.
echo "Your Mail-in-a-Box is running..."
while true; do sleep 10; done
fi