在AWS ECS中将带有卷参数的docker容器作为任务定义或服务运行

在AWS ECS中将带有卷参数的docker容器作为任务定义或服务运行,docker,nginx,amazon-ecs,aws-ecs,docker-gen,Docker,Nginx,Amazon Ecs,Aws Ecs,Docker Gen,我正在使用docker映像代理我的其他web应用程序。 我可以使用 docker run -d -p 80:80 -e ENABLE_IPV6=true -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy 指挥部。如果我运行docker时没有-v 即 它给出了错误: ERROR: you need to share your Docker host socket with a volume at /tmp/docker

我正在使用docker映像代理我的其他web应用程序。 我可以使用

docker run -d -p 80:80 -e ENABLE_IPV6=true -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
指挥部。如果我运行docker时没有
-v

它给出了错误:

ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock
Typically you should run your jwilder/nginx-proxy with: `-v /var/run/docker.sock:/tmp/docker.sock:ro`
See the documentation at http://git.io/vZaGJ
WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one is being generated in the background.  Once the new dhparam.pem is in place, nginx will be reloaded.
现在我的问题是,当我使用AWS ECS任务定义或服务运行此docker容器时,如何提供此
-v
参数


我可以在Dockerfile中提供
-v
参数吗?

v标志是绑定装入卷的缩写。您还可以在AWS管理控制台中通过向任务def修订版添加卷来完成此操作,然后在存储和日志部分的容器定义中,将该卷装载到容器中

AWS Fargate当前不支持绑定挂载。如果设置使用此nginx代理设置,您将希望坚持使用EC2主机的ECS编辑:这不再是事实,Fargate目前支持绑定挂载(感谢@bobics)


最后一个警告是,绑定装入的卷仅对装入它们的主机有效。因此,如果您作为主机运行多个EC2实例,您将有两个不同的绑定装载卷

不确定何时更改,但Fargate现在支持绑定边界。“在使用EC2或Fargate启动类型时,支持绑定装载主机卷。”我尝试在Fargate上绑定装载,但在它们工作时,它们看起来无法持久化。它不允许我在volumes->host下的task definition config中设置sourcePath值。Docker允许使用
-v
标志在运行时装载卷,但在ECS中,我们必须在容器定义期间定义装载点。如何在
运行任务期间指定音量?
ERROR: you need to share your Docker host socket with a volume at /tmp/docker.sock
Typically you should run your jwilder/nginx-proxy with: `-v /var/run/docker.sock:/tmp/docker.sock:ro`
See the documentation at http://git.io/vZaGJ
WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one is being generated in the background.  Once the new dhparam.pem is in place, nginx will be reloaded.