Question: I am currently running two virtual servers with [offical ghost image](https://registry.hub.docker.com/_/ghost/) and `nginx-proxy` image, here is my build-up.

```
docker run -d -p 86:2368 --name home -e "VIRTUAL_HOST=hostname.com" ghost 
docker run -d -p 85:2368 --name home-blog -e "VIRTUAL_HOST=blog.hostname.com" ghost

```

They are all working well, but after a while (sometimes hours or a day), one of the vitual server will break down, and I have to restart the container to make it work.

I wonder is there any solution to automatically monitor the docker container and restart it when it goes down?

Answer: 
You should use `--restart` ([docs](https://docs.docker.com/engine/reference/run/#restart-policies-restart)):

```
docker run -d -p 86:2368 --restart always --name home -e "VIRTUAL_HOST=hostname.com" ghost 

```
In fact, it is more likely your container's main application crashed and not your container.

When the process with ID #0 stops or crashes in a container, then the container automatically stops.

About your concern, the restart option (from the docker run command) is one possibility, as stated by Andy.

Another possibility is to use supervisord as container's main process. Your application will be launched and monitored by supervisord.
Supervisord will provide you with lots of options in order to handle your application crash. You have many useful options about logging, signal handling...

See <https://docs.docker.com/articles/using_supervisord/> and <http://supervisord.org/> for more details.