Here is a simple shell script that checks to see if docker is installed. If docker is installed it then filters to see if a container with a certain name is also running and  if it is not it will trigger the run command.

Good tutorial on shell scripting,