anchor.diff:  HOME=/root/
   docker="/usr/bin/<%= @docker_command %>"
   prog="docker-<%= @sanitised_title %>"
  -cidfile="/var/run/$prog.cid"
   if [ -d /var/lock/subsys ]; then
       lockfile="/var/lock/subsys/$prog"
   else
  
positive.code: }
  
  stop() {
      if ! [ -f $cidfile ]; then
          failure
          echo
          printf "$cidfile does not exist.\n"
          exit 7
      else
          cid="$(cat $cidfile)"
          if [ -n $cid ]; then
              echo -n $"Stopping $prog: "
              $docker stop $(cat $cidfile)
              retval=$?
              [ $retval -eq 0 ] && rm -f $lockfile
              return $retval
          fi
      fi
  }
  
  case "$1" in
  
negative.code: start() {
      [ -x $docker ] || exit 5
  
      if [ "true" = "$($docker inspect --format='{{.State.Running}}' <%= @sanitised_title %>)" ]; then
         failure
         printf "Container <%= @sanitised_title %> is still running.\n"
         exit 7
      fi
  
      printf "Starting $prog:\t"
      $docker rm <%= @sanitised_title %> >/dev/null 2>&1
      <% if @pull_on_start -%>
          $docker pull <%= @image %>
      <% end -%>
      $docker run \
      <%= @docker_run_flags %> \
      --name <%= @sanitised_title %> \
      <% if @extra_parameters %><% @extra_parameters_array.each do |param| %>  \
          <%= param %> <% end %> \
      <% end -%> \
      <%= @image %> \
      <% if @command %> <%= @command %><% end %>
  
      retval=$?
      echo
      if [ $retval -eq 0 ]; then
          success
      else
          failure
  