Reputation: 651
I have a slightly modified version of the container here:
http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/
To run it locally I use:
$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock -t jwilder/nginx-proxy
And run my other containers similar to below:
$ docker run -e VIRTUAL_HOST=my-domain.local -t -d my-repo/site-name
I'm having trouble converting this to a Task Definition on ECS.
Task definition
I have two containers:
nginx-reverse-proxy
static-site
I have a cluster with one ECS instance and a server with one task, defined above. This keeps cycling and fails with "STOPPED (Essential container in task exited)".
Now I assume I need to setup volumes but all the examples I can find have a path and a name and I can't see how I can convert this "/var/run/docker.sock:/tmp/docker.sock" into any fields available.
Upvotes: 3
Views: 4845
Reputation: 132
I'm quite late, but I'm going to answer anyway for people who come across this post in the future.
You have answered yourself. It fails because you are not sharing the Docker socket from the host, which is essential to the nginx proxy image.
Go to your Task Definition and add a new Volume. Name it socket and specify the host path /var/run/docker.sock. Then edit your nginx proxy container and under Mount Points choose socket as a source volume and /tmp/docker.sock as the container path. Mark it as read only for security reasons too. Leave the Command section for this container with the default value.
Deploy your new revision and it should work now.
Upvotes: 4