rebuild: Rebuild a container (destroy old, bootstrap, start new)
```
+If the environment variable "SUPERVISED" is set to true, the container won't be detached, allowing a process monitoring tool to manage the restart behaviour of the container.
+
### Container Configuration
The beginning of the container definition will contain 3 "special" sections:
image=samsaffron/discourse:1.0.3
docker_path=`which docker.io || which docker`
+if [ "${SUPERVISED}" = "true" ]; then
+ restart_policy="--restart=no"
+ attach_on_start="-a"
+ attach_on_run="-a stdout -a stderr"
+else
+ attach_on_run="-d"
+fi
+
if [ -x /sbin/ip ]; then
docker_ip=`/sbin/ip addr show docker0 | \
grep 'inet ' | \
echo "We recommend you upgrade docker, the version you are running has no restart policies, on reboot your container may not start up"
restart_policy=""
else
- restart_policy="--restart=always"
+ restart_policy=${restart_policy:---restart=always}
fi
exit 1
fi
- $docker_path run $restart_policy "${env[@]}" -h "`hostname`-$config" -e DOCKER_HOST_IP=$docker_ip --name $config -t --cidfile $cidfile $ports \
- -d $volumes $local_discourse/$config /sbin/runit
+ $docker_path run $attach_on_run $restart_policy "${env[@]}" -h "`hostname`-$config" -e DOCKER_HOST_IP=$docker_ip --name $config -t --cidfile $cidfile $ports \
+ $volumes $local_discourse/$config /sbin/runit
exit 0
else
fi
echo "cid found, ensuring container is started"
- $docker_path start `cat $cidfile`
+ $docker_path start $attach_on_start `cat $cidfile`
exit 0
fi