I'm developing a docker image based on nvidia/cuda:10.1-base-ubuntu18.04. At build time a custom web server is installed and I have a docker-entrypoint.sh which runs the server depending if an env var is set at run time.
This all works fine if I run the container in interactive mode:
docker run -it -p 5000:5000 -e RUN_SERVER=1 myImage/17.5.360/all /bin/bash
Or use the old "hack" to keep the image alive:
docker run -d -p 5000:5000 -e RUN_SERVER=1 myImage/17.5.360/all /bin/bash -c "tail -f /dev/null"
But when I follow the most recent answer from here:
docker run -t -d -p 5000:5000 -e RUN_SERVER=1 myImage/17.5.360/all
The image appears to load successfully and is kept alive, but the server is not active.
Here's the abridged version of docker-entrypoint.sh:
#! /bin/bash
if [ $RUN_SERVER = "1" ]; then
runMyServer
fi
exec "$@"
And Dockerfile:
FROM nvidia/cuda:10.1-base-ubuntu18.04 AS HInstaller
ENV RUN_SERVER=0 # Defaults to not run the server
# ...
COPY "./docker-entrypoint.sh" /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
How can I debug what's happening since interactive mode works?