NOTE: docker_version:1.13.0 image: ubuntu:14.04
I am trying to run a script in a container that starts a service inside the container. I run this script from an application which is running in the host machine and this application runs multiple scripts inside the container. All other scripts my application is running inside the container, executes successfully. However the script(start_service.sh) which starts the service inside a container executes without any error but does not start the service. But if I go inside the container and run the script as below it successfully starts the service.
docker exec -it TEST /bin/bash root@TEST# /scripts/start_service.sh
This start_service.sh script does a lot of modification and contains a line at the end which actually starts the service and does not work when start_service.sh is running from my application(in Host machine).
The line inside start_service.sh which actually starts the service is
/opt/$SERVICE.sh > /dev/null 2>&1 &
However if I change this line to
my application(in Host machine) starts the service but hangs in there until the service is closed. But obviously the intention is to keep the service running inside the container. It would be possible to use ‘screen’ to run the service in different screen but docker container does not support ‘screen’.
Is there any way I can run this script(start_service.sh) from my host machine that actually starts the service inside the container and does not hang there?
Please feel free to ask any question if the problem explanation is not understandable.