Reputation: 79
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:
Upvotes: 0
Views: 1763
Reputation: 6053
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.
"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?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
).
Upvotes: 1