1

I'm trying to dockerize a rails app and nginx with 2 separate containers. The rails app uses Unicorn and listens on a socket with static files serving from a folder. Now I need so somehow share the .sock and a folder to the NGINX container. This is how I ran 2 containers:

docker run -d --name app app:latest

docker run -d --name nginx -v /src/sockets:/src/sockets -v /src/public:/src/public --link app -p 80:80 nginx:latest

So expectedly, a .sock should be seen from /src/sockets inside Nginx container, but it becomes a folder instead, ie /src/sockets/app.sock/, and the static folder is empty.

Now these containers will be ran on AWS ECS, which is why I didn't use Docker-compose or share the volumes to host. I'm trying to mimic how ECS would work via Task Definition.

Casper
  • 1,663
  • 7
  • 35
  • 62
  • Hi, Do you looking for a shared volume to store app content and access from Nginx container? then you can try out EFS. Mount to host machine using user-data and using task definition use it to container. – Jogendra Kumar Apr 03 '18 at 09:22
  • EFS is too much for this thing I'm working on. For now I just use port instead of socket. – Casper Apr 03 '18 at 22:38

1 Answers1

0

Since you mentioned the goal is to do this on ECS, instead of using --link, it's better to use a docker volume and use that to share a directory across containers on ECS. See How to share file or directory with other container on ECS?

wonton
  • 7,568
  • 9
  • 56
  • 93