patterndockerMinor
What are best practices for sharing Docker compose files with ops team to use in Docker stack
Viewed 0 times
sharingwhatstackaredockerwithteamfilespracticesfor
Problem
I'm looking for best practices to share the Docker compose files created by developers with the people that do the deployment.
We use 2 docker compose files:
These files are included in version control (git in our case).
We have 2 options:
Since we are fairly new to this, I'm wondering how other organizations approach this, and why one method should be preferred over the other?
We use 2 docker compose files:
docker-compose.yml and docker-compose.prod.yml. These files are included in version control (git in our case).
We have 2 options:
- Include the compose files in the master branch, and checkout the entire master branch when the application needs to be deployed. Pro here is that it is easy to keep everything in sync, con that the entire projects needs to be cloned on the server when the application is deployed.
- Include the compose files in a orphaned branch that can be checked out when the application needs to be deployed. The pro here is that only the compose files will be checked out, con that we have 2 branches that needs to be maintained.
Since we are fairly new to this, I'm wondering how other organizations approach this, and why one method should be preferred over the other?
Solution
Some thoughts:
You can containerize docker-compose just like any other application.
- You do not have to clone the entire project. https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa discusses how to checkout a single file. I have also had good results using curl to get single files off github.
- You can containerize it. Like this
FROM docker/compose:1.21.2
RUN mkdir /src
WORKDIR /src
COPY docker-compose.yml /src/docker-compose.yml
ENTRYPOINT ["docker-compose"]
CMD []You can containerize docker-compose just like any other application.
Code Snippets
FROM docker/compose:1.21.2
RUN mkdir /src
WORKDIR /src
COPY docker-compose.yml /src/docker-compose.yml
ENTRYPOINT ["docker-compose"]
CMD []Context
StackExchange DevOps Q#4216, answer score: 2
Revisions (0)
No revisions yet.