Xameer
Xameer

Reputation: 31237

Deploy app created with docker-compose to AWS

Final goal: To deploy a ready-made cryptocurrency exchange on AWS.

I have setup a readymade server by 0xProject by running the following command on my local machine:

npx @0x/launch-kit-wizard && docker-compose up

This command creates a docker-compose.yml file which has multiple container definitions and starts the exchange on http://localhost:3001/

I need to deploy this to AWS for which I'm following this Youtube tutorial

As per AWS instructions, I'm retrieving an authentication token and authenticating Docker client to registry:

aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin <docker-id-given-by-AWS>.dkr.ecr.us-east-2.amazonaws.com

I'm trying to build the docker image:

docker build -t testdockerregistry .

Now, since in this case, we have docker-compose.yml instead of Dockerfile - when I try to build the image - it throws the following error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: CreateFile C:\Users\hp\Desktop\xxx\Dockerfile: The system cannot find the file specified.

I tried building image from docker-compose itself as per this guide, which fails with the following message:

postgres uses an image, skipping
frontend uses an image, skipping
mesh uses an image, skipping
backend uses an image, skipping
nginx uses an image, skipping

Can anyone please help me with this?

Upvotes: 2

Views: 1631

Answers (2)

VonC
VonC

Reputation: 1324178

Another approach, instead of using the AWS ECS CLI directly, is to use the new docker/compose-cli

This CLI tool makes it easy to run Docker containers and Docker Compose applications in the cloud using either Amazon Elastic Container Service (ECS) or Microsoft Azure Container Instances (ACI) using the Docker commands you already know.

See "Docker Announces Open Source Compose for AWS ECS & Microsoft ACI " from Aditya Kulkarni.
It references "Docker Open Sources Compose for Amazon ECS and Microsoft ACI" from Chris Crone, Engineer @docker:

While implementing these integrations, we wanted to make sure that existing CLI commands were not impacted.
We also wanted an architecture that would make it easy to add new backends and provide SDKs in popular languages. We achieved this with the following architecture:

https://res.infoq.com/news/2020/10/docker-announces-compose-ecs-aci/en/resources/1CLI%20Architecture-1602557186982.png

Upvotes: 1

Chris Williams
Chris Williams

Reputation: 35188

You can use the aws ecs cli-compose command from the ECS CLI.

By using this command it will translate the docker-compose file you create into a ECS Task Definition.

If you're interested in finding out more about the CLI take a read of the AWS documentation here.

Upvotes: 1

Related Questions