I am running Nginx on Ubuntu 14.04 as a reverse proxy to my .NET Core Web APIs. It works well, starting with the command line:
docker run --name=nginx -d -v /mercury/config/nginx:/etc/nginx/conf.d -v /mercury/logs/nginx:/var/log/nginx -p0.0.0.0:443:443 -t docker-registry.public-upstream.gray.net/nginx
I want the container to restart if it crashes or the server is restarted, which (according to the documentation) can be achieved by adding --restart=unless-stopped
to the command line.
However, when I do this, I get the error:
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"--restart=unless-stopped\": executable file not found in $PATH".
I'm not sure where to go from here - what executable file is it looking for, since I'm running a container? Why does this error occur with the flag, but docker can start the container fine without it?
I've dug around one Google, but have not been able to find a solution. There are a fair number of similar questions but few solutions and none which seem to apply in my case.
Edit:
I should mention that in my case this is specific to nginx - my own containers run fine with the --restart
switch specified.
Try this.
docker run --name=nginx --restart unless-stopped -d -v /mercury/config/nginx:/etc/nginx/conf.d -v /mercury/logs/nginx:/var/log/nginx -p0.0.0.0:443:443 -t docker-registry.public-upstream.gray.net/nginx