November 17, 2022

Docker-stack-deploy: Background and usage

Docker background:

Since its release in 2013, Docker has proved to be a reliable open platform for developers and became a revolutionizer of the whole software industry. The accessibility for developers and possibility of rapid deployments made Docker one of the most popular platforms, with over 3 million installations and tens of thousands of companies using it.

Even though there is a lot of buzz around Kubernetes, Docker Swarm (mode) is still a reasonable choice for deployments - especially in smaller scale setups. The reason is its simplicity.

Further development of Docker:

We at Neuroforge believe that making the communities' life easier will benefit everyone. As Docker Swarm mode has some smaller rough edges, we decided to create a utility that makes Docker more automated and even more user-friendly.

May I present: docker-stack-deploy für Docker Swarm

Docker Stack files are a great way to organize your deployments. The problem is, though, that Docker Swarm does not allow changes in secrets and configs. This means that you have to manually rotate configs/secrets yourself.

Docker-stack-deploy ist ein kleines Python-Skript, das den eigentlichen docker stack deploy Befehl kapselt und alle Stack-Dateien in den Argumenten abfängt, indem es sie so umschreibt, dass Configs und Secrets automatisch rotiert werden, wenn sich der Inhalt der referenzierten Dateien geändert hat.

To use it, just write docker stack deploy:

docker-sdp stack deploy

FAQ about docker-stack-deploy

1) What was the idea behind docker-stack-deploy?

This tool is a layer around docker stack deploy that caused us some headaches for automation. We are building some of our internal tooling and app deployments around Docker Swarm due to the low barrier for entry. The main clustering concepts are the same between all the major container orchestrators. While using our setup, we also took older tutorials and versions for Docker Swarm mode and modernized them on our GitHub. For example, see our modernized swarmprom for cluster monitoring here:

2) Is there any other solution?

Another smart solution people have come up with is appending the hashcode of the secret/config via an env var in the stack file. This however requires manually wrapping the deployment script in a process that generates this hash. With docker-stack-deploy, this is not required anymore.

3) Does it support multiple stack files (inheritance)?

Sure! It also supports multiple stack files and rewrites all files passed to the command line.

Cookie Consent Banner by Real Cookie Banner