I run that:
docker run -it --restart always --net=host myImage /bin/bash
And I stay interactive then I run (inside the docker container)
/start.sh
and everything is ok
My idea is to run /start.sh directly with docker run command
I tried that:
docker run -it --restart always --net=host myImage /bin/bash -c "/start.sh"
Which seems to work, but once the start.sh finishes tasks, docker quits the interactive mode
start.sh only contains starting service
service apache start;
service mysql start;
pm2 start /chat.js;
PID 1and after it stops, the container stops too. This happens because containers are up & running as long as PID 1 is running.exec "$@". The idea here is that, this executable will be responsible to catch the signals and gracefully stop all the services that you are running.tail -f /dev/nullis proposed to keep the container running.