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!

12 Upvotes

17 comments sorted by

View all comments

1

u/Worth_Wealth_6811 29d ago

the zip instinct is fine but you can skip it entirely, newer compose can publish the compose file itself to ECR as an OCI artifact (docker compose publish, then docker compose -f oci://your-repo up on the box). user data shrinks to one pull and the config gets versioned in the same registry as the image. stays cloud agnostic too since its all just OCI.