X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=launcher;h=4e615927503187c33d970fc27142d7ad0238e080;hb=2f7a204e0ed810526dc792c1ac00d508766e03a0;hp=ec208264a052a22438b133f8ef714c9abcdb0949;hpb=16fb17cf51793a5cbf5c364fb8e4497b6d3253a1;p=discourse_docker.git diff --git a/launcher b/launcher index ec20826..4e61592 100755 --- a/launcher +++ b/launcher @@ -13,6 +13,7 @@ usage () { echo " run: Run the given command with the config in the context of the last bootstrapped image" echo " rebuild: Rebuild a container (destroy old, bootstrap, start new)" echo " cleanup: Remove all containers that have stopped for > 24 hours" + echo " start-cmd: Generate docker command used to start container" echo echo "Options:" echo " --skip-prereqs Don't check launcher prerequisites" @@ -80,8 +81,8 @@ git_rec_version='1.8.0' config_file=containers/"$config".yml cidbootstrap=cids/"$config"_bootstrap.cid local_discourse=local_discourse -image=discourse/base:2.0.20190217 -docker_path=`which docker.io || which docker` +image="discourse/base:2.0.20190321-0122" +docker_path=`which docker.io 2> /dev/null || which docker` git_path=`which git` if [ "${SUPERVISED}" = "true" ]; then @@ -549,23 +550,26 @@ merge_user_args() { run_start() { - existing=`$docker_path ps | awk '{ print $1, $(NF) }' | grep " $config$" | awk '{ print $1 }'` - echo $existing - if [ ! -z $existing ] + if [ -z "$START_CMD_ONLY" ] then - echo "Nothing to do, your container has already started!" - exit 0 - fi + existing=`$docker_path ps | awk '{ print $1, $(NF) }' | grep " $config$" | awk '{ print $1 }'` + echo $existing + if [ ! -z $existing ] + then + echo "Nothing to do, your container has already started!" + exit 0 + fi - existing=`$docker_path ps -a | awk '{ print $1, $(NF) }' | grep " $config$" | awk '{ print $1 }'` - if [ ! -z $existing ] - then - echo "starting up existing container" - ( - set -x - $docker_path start $config - ) - exit 0 + existing=`$docker_path ps -a | awk '{ print $1, $(NF) }' | grep " $config$" | awk '{ print $1 }'` + if [ ! -z $existing ] + then + echo "starting up existing container" + ( + set -x + $docker_path start $config + ) + exit 0 + fi fi host_run @@ -606,7 +610,12 @@ run_start() { mac_address="--mac-address $($docker_path run $user_args -i --rm -a stdout -a stderr $image /bin/sh -c "echo $hostname | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'")" fi + if [ ! -z "$START_CMD_ONLY" ] ; then + docker_path="true" + fi + set -x + $docker_path run --shm-size=512m $links $attach_on_run $restart_policy "${env[@]}" "${labels[@]}" -h "$hostname" \ -e DOCKER_HOST_IP="$docker_ip" --name $config -t "${ports[@]}" $volumes $mac_address $user_args \ $run_image $boot_command @@ -734,6 +743,12 @@ case "$command" in exit 0 ;; + start-cmd) + START_CMD_ONLY="1" + run_start + exit 0; + ;; + start) run_start exit 0