Docker Container won't stop with bash jobcontrol enabled

385 Views Asked by At

I have a very simple Dockerfile which extends the mssql one, as you can see below. Two additional scripts are put into the final image, one with some database setup stuff, the otherone the entrypoint.sh which I use as wrapper to first start the sql server and the import script. when this is done, the sql process should come back to the foreground, which it does.

I have a main process and some kinda temporary setup script, which has to run after the main process started. After the helper script finished. The main process comes back to foreground and should handle all signals. However it does not.

There is even an example project in the docker documentation which does exactly the same.

Is there any way getting this to work since this seems like a very common problem (and of course job control is a hack.)

#!/bin/bash

# turn on bash's job control
set -m

# Start the primary process and put it in the background
./my_main_process &

# Start the helper process
./my_helper_process

# the my_helper_process might need to know how to wait on the
# primary process to start before it does its work and returns


# now we bring the primary process back into the foreground
# and leave it there
fg %1
0

There are 0 best solutions below