From: Dave Eargle Date: Mon, 11 Feb 2019 21:27:23 +0000 (+0000) Subject: merge docker_args with user_args for launcher file X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bfc79e773024fbbc80af3253b7a5aaa904a26079;p=discourse_docker.git merge docker_args with user_args for launcher file --- diff --git a/launcher b/launcher index adbf2dc..830f80b 100755 --- a/launcher +++ b/launcher @@ -450,6 +450,8 @@ RUBY echo "YAML syntax error. Please check your containers/*.yml config files." exit 1 fi + + merge_user_args } if [ -z $docker_path ]; then @@ -534,6 +536,17 @@ set_boot_command() { fi } +merge_user_args() { + local docker_args + + docker_args=`cat $config_file | $docker_path run $user_args --rm -i -a stdout -a stdin $image ruby -e \ + "require 'yaml'; puts YAML.load(STDIN.readlines.join)['docker_args']"` + + if [[ -n "$docker_args" ]]; then + user_args="$user_args $docker_args" + fi +} + run_start() { existing=`$docker_path ps | awk '{ print $1, $(NF) }' | grep " $config$" | awk '{ print $1 }'` @@ -557,9 +570,6 @@ run_start() { host_run - docker_args=`cat $config_file | $docker_path run $user_args --rm -i -a stdout -a stdin $image ruby -e \ - "require 'yaml'; puts YAML.load(STDIN.readlines.join)['docker_args']"` - set_template_info set_volumes set_links @@ -598,7 +608,7 @@ run_start() { 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 $docker_args $user_args \ + -e DOCKER_HOST_IP="$docker_ip" --name $config -t "${ports[@]}" $volumes $mac_address $user_args \ $run_image $boot_command )