Closed imriss closed 8 years ago
Good idea. Maybe you can also have another option for background without detached (to have the log):
#!/bin/sh
# Defaults
PORT="8000"
IMAGE="erctcalvin/calvin:master"
FLAGS="-it" # Run interactive w/ tty
usage() {
echo "Usage: $(basename $0) \n\
-i <image>[:<tag>] : Docker image (and tag) to use [$IMAGE]\n\
-p <port> : Port to use [$PORT]\n\
-d : Detach and run in background\n
-b : Run in background (Attached. To be used along with \&)\n"
exit 1
}
while getopts "i:p:hdb" opt; do
case $opt in
p)
PORT="$OPTARG"
;;
i)
IMAGE=$OPTARG
;;
d)
FLAGS=-d
;;
b)
FLAGS=
;;
h)
usage;
;;
esac
done
docker run -p $PORT:8000 $FLAGS --entrypoint csweb $IMAGE
What do you gain from that?
To get the log from the container, one can use the returned container id, e.g.
$ docker logs -f $(./dcsweb.sh -d)
Is that insufficient?
Thanks. That would work fine.
Available on develop branch, commit b28515ee3355eb562310f43be393d0dc4b285156.
Closing.
I'd prefer to have it as an option to the dcsweb script rather than a separate script.. How about: