0

I'm trying to deploy docker compose to amazon ECS.

I have created this docker compose file:


services:
  consul-server:
    container_name: consul-server
    hostname: consul-server
    image: consul:1.12.2
    command: agent -server -ui -node=server1 -bootstrap-expect=1 -client=0.0.0.0
    ports:
      - 8400:8400
      - 8500:8500
      - 8600:8600/udp
    networks:
      - xp_network
  
  infra-service:
    image: infra-service-docker-img:latest
    build: .
    container_name: infra-service
    hostname: infra-service
    ports:
      - 5011:5011
    networks:
      - xp_network

networks:
  dxp_network:
      name: xp-vpc

I create an ECS context to target Amazon ECS using the following commands:

docker context create ecs ecscontext

I have AWS credentials set up in the local environment for authenticating with the ECS platform.(I did aws configure and add the keys)

and then I use an existing AWS profile. After I checked i created the new context (docker context ls) I ensured that i was using my context.

Run --> docker compose up

When I a do docker-compose up -d I can see that Container infra-service Started and Container consul-server Started.

When I check the state of the services I can not see any difference on the PORTS. No connection to aws and no resources created there also :S

enter image description here

basically I did:

$ aws configure
         --> keys
         --> region

$ docker compose build

$ docker context create ecs ecscontext
        --> An existing AWS profile

$ docker context use ecscontext

$ docker compose up

$ docker compose ps

PLEASE!!!Anyone can tell me what I'm doing wrong? Do you think that it's something related to the credentials set up?

Tom
  • 1
  • 1
  • What does this mean? "When I check the state of the services I can not see any difference on the PORTS. No connection to aws and no resources created there also"? There will be nothing in your local `docker ps` output or anything like that to indicate anything is running on AWS. When you run docker-compose up with ECS it generates a CloudFormation template and deploys that on AWS. You need to check if the CloudFormation stack was created in AWS and what its deployment state is. – Mark B Jan 17 '23 at 16:52
  • Hi @MarkB That's the problem when I ran the docker compose nothing happens...In my cloudFormation nothing it's created. Is there a problem with the credentials? – Tom Jan 18 '23 at 10:02
  • After selecting the `ecs` context, the output from `docker-compose up` should have been drastically different. Per the official documentation: https://aws.amazon.com/blogs/containers/deploy-applications-on-amazon-ecs-using-docker-compose/ If that's not happening then I suggest you start from the beginning, following that documentation. – Mark B Jan 18 '23 at 13:28
  • Are you getting any errors? Does it deploy in a default context? – PowerMan2015 Feb 16 '23 at 12:04

0 Answers0