ECS Fargate不支持绑定安装 [英] ECS Fargate does not support bind mounts

查看:189
本文介绍了ECS Fargate不支持绑定安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将nodejs docker-compose应用程序部署到AWS ECS中,这是我的docker compose文件的外观-

I am trying to deploy a nodejs docker-compose app into aws ecs, here is how my docker compose file looks -

version: '3.8'

services:
 sampleapp:
  image: jeetawt/njs-backend
  build:
   context: .
  ports:
   - 3000:3000
  environment:
   - SERVER_PORT=3000
   - CONNECTIONSTRING=mongodb://mongo:27017/isaac
  volumes:
   - ./:/app
  command: npm start

 mongo:
  image: mongo:4.2.8
  ports:
   - 27017:27017
  volumes:
   - mongodb:/data/db
   - mongodb_config:/data/configdb
volumes:
 mongodb:
 mongodb_config:

但是,当我尝试在创建ecs上下文后使用docker进行运行时,它会抛出以下错误-

However when i try to run it using docker compose up after creating ecs context, it throws below error -

WARNING services.build: unsupported attribute        
ECS Fargate does not support bind mounts from host: incompatible attribute

我没有指定要在其中使用 Fargate 的任何位置.有什么方法可以使我仍然使用ec2而不是 Fargate 部署应用程序?

I am not specifying any where that I would like to use Fargate for this. Is there any way I can still deploy the application using ec2 instead of Fargate?

推荐答案

Fargate是默认设置,无法告诉您要部署在EC2上.但是在某些情况下,当Fargate无法提供所需的功能(例如GPU)时,我们必须在EC2上进行部署.

Fargate is the default and there is no way to tell it that you want to deploy on EC2 instead. There are however situations where we have to deploy on EC2 when Fargate can't provide the required features (e.g. GPUs).

如果您确实确实需要使用绑定安装并需要一个EC2实例,则可以使用此技巧(我没有做过,所以我基本上是在这里集思广益):

If you really really need to use bind mounts and need an EC2 instance you may use this trick (I haven't done it so I am basically brainstorming here):

  • 配置您的任务以使用GPU(在此处查看示例)
  • 使用 docker compose convert
  • 转换您的撰写
  • 手动编辑CFN模板以使用其他实例类型(以避免部署具有相关价格的基于GPU的实例)
  • 部署生成的CFN模板.

如果确实需要,您甚至可以通过一些 sed 马戏团来自动执行此操作.

You may even be able to automate this with some sed circus if you really need to.

正如我所说,我还没有尝试过,也不确定这样做是否可行.但这不会太复杂.

As I said, I have not tried it and I am not sure how viable this could be. But it wouldn't be too complex I guess.

这篇关于ECS Fargate不支持绑定安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆