Tom
Tom

Reputation: 1

How can I use docker compose to deploy to ECS

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?

Upvotes: 0

Views: 851

Answers (0)

Related Questions