英文:
How do I configure an nginx AWS ECS container with an nginx.conf file
问题
我有一个dotNet应用程序在一个容器中,另一个容器中有一个nginx镜像。nginx镜像是一个已经配置好的镜像,使用一个nginx.conf文件,该文件已构建并上传到AWS ECS以包含在任务定义中。任务定义已经设置为使用Fargate。
这个工作正常。
与其定期更新镜像并重新上传到每个任务定义,我希望更改ECS任务定义,直接从Docker使用nginx:latest镜像。
我无法弄清楚如何在任务定义中配置该镜像以使用我的nginx.conf文件。有人能帮助我吗?
英文:
I have a dotNet application in one container and an nginx image in another container. The nginx image is an already configured image, using an nginx.conf which is built and uploaded to aws ecs to be included into task definitions. The tasks definition is set up with fargate.
This works fine.
Rather than having to regularly update the image and re-upload it for each task definition, I should like to change the ecs task definition to use the nginx:latest image direct from docker.
What I cannot work out is how to configure that image with my nginx.conf file in the task definition. Can anyone help me out with this please?
答案1
得分: 1
如果您想部署官方的Nginx Docker镜像而不对镜像进行任何更改,那么您需要通过在一个文件夹中放置一个nginx.conf
文件并将其挂载到容器中来进行配置。由于您正在使用Fargate,目前唯一的选项是创建一个EFS卷,将您的nginx.conf文件放入该卷中,然后配置您的ECS任务将该卷挂载到容器中。
英文:
If you want to deploy the official Nginx docker image, without making any changes to the image, then you will have to configure it by having an nginx.conf
file in a folder that gets mounted into the container. Since you are using Fargate, the only option for doing this, at this time, is to create an EFS volume, put your nginx.conf file in that volume, and then configure your ECS task to mount the volume into your Nginx container.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论