From: Matt Palmer Date: Wed, 27 Apr 2016 05:38:40 +0000 (+1000) Subject: Produce random-but-stable MAC addresses, take 2 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d2a86ee1a70d0ed6123aaf58cbbc5bc28b13bb08;p=discourse_docker.git Produce random-but-stable MAC addresses, take 2 This version works properly on ye olde versions of Docker (v1.7 was reported as not working with the previous version of this patch). --- diff --git a/launcher b/launcher index b2a090a..f7152d7 100755 --- a/launcher +++ b/launcher @@ -800,9 +800,12 @@ run_start() { # docker added more hostname rules hostname=${hostname/_/-} + 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/'")" + set -x $docker_path run $user_args $links $attach_on_run $restart_policy "${env[@]}" -h "$hostname" \ - -e DOCKER_HOST_IP=$docker_ip --name $config -t $ports $volumes $docker_args $run_image $boot_command + -e DOCKER_HOST_IP=$docker_ip --name $config -t $ports $volumes $mac_address $docker_args \ + $run_image $boot_command ) exit 0