Search code examples
amazon-web-servicesdockernginxdocker-composeamazon-ecs

AWS ECS-CLI docker-compose.yml depends_on error "services.nginx.depends_on.0 must be a string"


I was learning FARGATE services using AWS-ecs-cli. I was trying to execute ecs-cli compose --file docker-compose.yml service start.
But the error message said,

ERRO[0000] Unable to open ECS Compose Project error="services.nginx.depends_on.0 must be a string" FATA[0000] Unable to create and read ECS Compose Project error="services.nginx.depends_on.0 must be a string"

How can I solve this problem? Here is my code about 'docker-compose.yml'

#docker-compose.yml
version: '3'
services:
  nginx:
    essential: true
    build: ./nginx
    image: [ECR Image URI]
    restart: always
    ports:
      - "80:80"
    volumes:
      - /srv/docker-server
      - /var/log/nginx
    depends_on:
      - container_name: django
  django:
    essential: true
    build: ./fastcampus_test
    image: [ECR Image URI]
    restart: always
    command: uwsgi --ini uwsgi.ini
    volumes:
      - /srv/docker-server
      - /var/log/uwsgi

Solution

  • depends_on:
      - django
    

    In YAML, lines that start with - can be thought of as lists, and lines with a colon are key/value maps. In your case you want a list of strings (your error is describing offset 0 of your depends_on list).