Docker 组合 ECS 错误:资源处理程序返回消息:“模型验证失败(#/Volumes:数组项不唯一)" [英] Docker compose up ECS error: Resource handler returned message: "Model validation failed (#/Volumes: array items are not unique)"

查看:28
本文介绍了Docker 组合 ECS 错误:资源处理程序返回消息:“模型验证失败(#/Volumes:数组项不唯一)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将我的 Postgres + Backend + Prisma 映像部署到 Amazon ECS,但遇到了这个错误:

资源处理程序返回消息:模型验证失败(#/Volumes:数组项不唯一)"

我已经坚持了几天,任何帮助将不胜感激.我使用我的 Amazon ECS 上下文运行 docker compose up 以解决此错误.

版本:'3.4'服务:D b:容器名称:db端口:- 5432:5432图片:postgres:最新环境:- POSTGRES_USER=[用户]- POSTGRES_PASSWORD=[密码]卷:- 我的卷:/var/lib/postgresql/data/2后端:取决于:- D b容器名称:后端端口:- 4000:4000图像:[后端图像名称]棱镜:取决于:- D b容器名称:棱镜端口:- 5555:5555图像:[棱镜图像名称]环境:NODE_ENV:生产卷:我的卷:

解决方案

AWS 容器服务团队成员在这里.我从未见过该错误,但上面的代码中有些地方似乎不正确,使我无法对其进行测试.

  • 服务应该缩进版本
  • 如果我尝试使用该卷映射启动(在 AWS 中)Postgres,它会吐出一个 "initdb: error: directory "/var/lib/postgresql/data"存在但不为空"错误.即使在 docker 主机上本地启动 Postgres(使用 docker-compose up),Postgres 也会失败,尽管我没有在那里进一步调查.你有 /2 有什么原因吗?这应该有效吗?
  • 您可以通过指定 host:container 端口,通过负载均衡器公开所有服务.我假设您只想公开 prisma 容器?还是我误解了你在做什么?

这是对你的撰写稍作修改的版本,对我来说似乎很好用:

版本:'3.4'服务:D b:容器名称:db图片:postgres:最新环境:- POSTGRES_USER=我- POSTGRES_PASSWORD=我的密码卷:- 我的卷:/var/lib/postgresql/data后端:取决于:- D b容器名称:后端图片:nginx棱镜:取决于:- D b容器名称:棱镜端口:- 80:80图片:nginx环境:NODE_ENV:生产卷:我的卷:

注意,我刚刚使用伪造的 nginx 图像更改了 Prisma 和后端容器图像,只是为了提升堆栈(我还必须将端口更改为 80:80).

I have been trying to deploy my Postgres + Backend + Prisma images to Amazon ECS but have been running into this error:

Resource handler returned message: "Model validation failed (#/Volumes: array items are not unique)"

I have been stuck on this for a couple of days and any help would be appreciated. I run docker compose up using my Amazon ECS context to get to this error.

version: '3.4'
    services:
      db:
        container_name: db
        ports:
          - 5432:5432
        image: postgres:latest
        environment:
          - POSTGRES_USER=[user]
          - POSTGRES_PASSWORD=[password]
        volumes:
          - my-vol:/var/lib/postgresql/data/2
      backend:
        depends_on:
          - db
        container_name: backend
        ports:
          - 4000:4000
        image: [backend image name]
      prisma:
        depends_on:
          - db
        container_name: prisma
        ports:
          - 5555:5555
        image: [prisma image name]
        environment:
          NODE_ENV: production
    volumes:
      my-vol:

解决方案

AWS container service team member here. I have never seen that error but there are a few things that don't seem right in the code above and that prevent me to be able to test it.

  • services should be indented with version
  • if I try to bring up (in AWS) Postgres with that volume mapping it spits an "initdb: error: directory "/var/lib/postgresql/data" exists but is not empty" error. Postgres fails even if brought up locally on a docker host (with docker-compose up) albeit I did not investigate further there. Is there a reason why you have the /2? Is that supposed to work?
  • You expose all services via the load balancer by specifying the host:container ports. I assume you only want the prisma container to be exposed? Or am I misinterpreting what you are doing?

This is a slightly modified version of your compose that seems to be working just fine for me:

version: '3.4'
services:
  db:
    container_name: db
    image: postgres:latest
    environment:
      - POSTGRES_USER=me
      - POSTGRES_PASSWORD=mypassword
    volumes:
      - my-vol:/var/lib/postgresql/data
  backend:
    depends_on:
      - db
    container_name: backend
    image: nginx
  prisma:
    depends_on:
      - db
    container_name: prisma
    ports:
      - 80:80
    image: nginx
    environment:
      NODE_ENV: production  
volumes:
  my-vol:

Note I have just changed the prisma and backend container images with fake nginx images just for the purpose of bringing the stack up (I also had to change the port to 80:80).

这篇关于Docker 组合 ECS 错误:资源处理程序返回消息:“模型验证失败(#/Volumes:数组项不唯一)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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