Reputation: 149
I'm using ecs-cli
to deploy my docker-compose.yml
to ecs.
Why when I defined volumes ecs-cli
copy and create files/directories inside the container, rather than in host-ec2-ami? how can I tell the html must be on host-ec2-ami-machine?
./appsy/dockerfile:
FROM nginx:latest
ADD ./index.html /content/index.html
./appsy/index.html:
<div> hello</div>
./docker-compose.yml
version: '3'
services:
web:
image: 0000000.dkr.ecr.us-east-2.amazonaws.com/appsy:latest
volumes:
- /content:/usr/share/nginx/html
ports:
- '80:80'
Upvotes: 0
Views: 223
Reputation: 2875
how can I tell the html must be on host-ec2-ami-machine?
If you want to reference files/directories on the host from within the container, then you did the correct attempt to use volumes
:
Your docker-compose.yaml
essentially says "mount host /content
directory to /usr/share/nginx/html
directory in your container".
Note, however, in that case copying index.html
into the container (which you do in your Dockerfile
) does not make any sense...
Upvotes: 0