jingo_man
jingo_man

Reputation: 529

AWS ECS with Docker Compose Files - "External" Docker Volumes

I have existing docker-compose.yml file that runs on my Docker CE standalone server.

I would like to deploy this same configuration using the AWS ECS service. The documentation of the ecs-cli tool states that Docker Compose files can be used. Other (simpler) container configs have worked with my existing files.

With my configuration, this errors with:

ERRO[0000] Unable to open ECS Compose Project error="External option is not supported"

FATA[0000] Unable to create and read ECS Compose Project error="External option is not supported"

I am using "external" Docker volumes, so that they are auto-generated as required and not deleted when a container is stopped or removed.

This is a simplification of the docker-compose.yml file I am testing with and would allow me to mount the volume to a running container:

version: '3'

services:
  busybox:
    image: busybox:1.31.1
    volumes:
      - ext_volume:/path/in/container

volumes:
  ext_volume:
    external: true

Alternatively, I have read in other documentation to use the ecs-params.yml file in the same directory to pass in variables. Is this a replacement to my docker-compose.yml file? I had expected to leave it's syntax unchanged.

Upvotes: 2

Views: 3416

Answers (1)

jingo_man
jingo_man

Reputation: 529

Working config (this was ensuring the container stays running, so I could ssh in and view the mounted drive):

version: '3'

services:
  alpine:
    image: alpine:3.12
    volumes:
      - test_docker_volume:/path/in/container
    command:
      - tail 
      - -f 
      - /dev/null

volumes:
  test_docker_volume:

And in ecs-params.yml:

version: 1
task_definition:
  services:
    alpine:
      cpu_shares: 100
      mem_limit: 28000000
  docker_volumes:
    - name: test_docker_volume
      scope: "shared"
      autoprovision: true

Upvotes: 3

Related Questions