r/devops • • Aug 12 '26

Architecture Deploying docker-compose.yml

Hello all. The circumstance I have working with is the following:
* I have an Apache2 PHP server that gets bundled as a Docker image in a CI process to ECR

* I have an infra repository with a docker-compose.yml that bundles the PHP Docker image to an Nginx image, alongside Nginx config like attaching TLS certs

When the CICD process deploys a release, it deploys a new EC2 with a given user data script to prop up the server. If I only had a Docker image, the user data would generally look like "Pull down ECR image and start image", however in this case I am spinning up a docker-compose.yml file.

How is this typically done? I suppose I *can* add a CI process to zip up the docker-compose.yml and related nginx config, however feels backwards? Is there a consensus with this?

If I am fundamentally misunderstanding something let me know, I'd say my only constraint is I'd like to solve this problem in a relatively cloud agnostic environment (so keeping EC2 as a VM, ECR as a registry, but excluding abstractions like Fargate or ECS)

Thanks!

13 Upvotes

17 comments sorted by

View all comments

Show parent comment

6

u/MDivisor Aug 12 '26

The load balancer is not the problem with the scaling. It's the fact that you need a separate compose file for each VM and they don't talk to each other in any way.

In a more complicated setup you could have X amount of servers and Y amount of different services (some possibly with multiple replica instances) you need to run. This becomes very tedious to manage with per-server compose files. With a container orchestrator (like Kubernetes or ECS), you just tell the orchestrator "these are your VMs and these are the containers I want to run, you figure out what goes where and network them together".

1

u/BrocoLeeOnReddit Aug 13 '26

This and you can automatically scale up/down depending on usage metrics.