Docker-compose to docker file
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Hi,

We have this docker-compose.yml file from here:

https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/dev/docker-compose.yml

We'd like to have it successfully ported to a simple docker file as we would like to deploy this software on AWS ECS which currently does not support the docker-compose v3.7 file format.

Thanks!.

Can you not just use version: '3.0' I don't see anything obvious that specifically requires 3.7 and ECS supports compose 3.0
jwetzell 1 month ago
Unfortunately no. We have already tried this and we are getting several errors along the way.
Jack 1 month ago
jwetzell is correct about the version. What errors do you get?
dekkard 1 month ago
We did try that in our lab environment, The current AWS ECS "ecs-cli compose" strictly supports v3.0 while the project is using v3.7, as I said. Below is the error we received:

```

ERRO[0000] Unable to open ECS Compose Project error="Unsupported Docker Compose version found: 3.7"

FATA[0000] Unable to create and read ECS Compose Project error="Unsupported Docker Compose version found: 3.7"

``` In order to get the docker-compose.yaml to the specification of v3.0, we would have to make modifications and some of the features in use may not be supported. Such as, the long syntax being used for port configuration came with v3.2.
Jack 1 month ago
My bad for such ugly formatting. I am mobile atm.
Jack 1 month ago
I mean, what does it say when you specify version: '3' in your compose file?
dekkard 1 month ago
Not too sure right now. I know we have tried that and we got an error at some deployment point. We were not able to overcome it because of the ecs-cli compose current limitations. Also, the AWS support advised use trying to convert this one into a docker file instead. Which we are trying to do using bigger brains than ours.
Jack 1 month ago
awarded to tomtoump

Crowdsource coding tasks.

1 Solution

Winning solution

While I work on trying to make it work with ECS, make sure to check their Cloudformation repo in case that works for you.

Update:

Check out my gist.

Some basic commands to get you started:

  • Create IAM role

aws iam --region us-east-1 create-role --role-name ecsTaskExecutionRole --assume-role-policy-document file://task-execution-assume-role.json

aws iam --region us-east-1 attach-role-policy --role-name ecsTaskExecutionRole --policy-arn arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy

  • Create ecs-cli profile

ecs-cli configure profile --profile-name bountify --access-key ACCESS_KEY --secret-key SECRET_KEY

  • Configure cluster

ecs-cli configure --cluster bountify --region us-east-1 --default-launch-type EC2 --config-name bountify

  • Create cluster

ecs-cli up -capability-iam --instance-type t3.large --keypair bountify

  • Allow incoming traffic to :8080

aws ec2 authorize-security-group-ingress --group-id "sg-*****************" --protocol tcp --port 8080 --cidr 0.0.0.0/0 --region us-east-1

  • Deploy application

ecs-cli compose --project-name bountify service up --cluster-config bountify

  • Destroy

ecs-cli down --force --cluster-config bountify --cluster bountify

That is a standalone solution. We are looking to use ECS or Fargate to deploy this software. Regards.
Jack 1 month ago
Also. notice there are some serious limitations if you are deploying the software into that configuration.
Jack 1 month ago
Thank you!
Jack 1 month ago