brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: docker stack config prints the merged and interpolated stack file

Docker
~/tips/tip-docker-stack-config-merge

docker stack config -c docker-compose.yml -c docker-compose.prod.yml

Outputs the final Compose file after merging and variable substitution, before you deploy it to a swarm.

If you use more than one Compose file for a swarm stack, you want to see the result before you deploy it. docker stack config prints it without touching the swarm.

docker stack config -c docker-compose.yml -c docker-compose.prod.yml

The docs describe it as outputting the final Compose file after doing the merges and interpolations of the input files. The -c (--compose-file) option can be given several times, or you can pass - to read the file from stdin.

Variables like ${TAG} are replaced from your environment in that output. Sometimes you do not want that, and --skip-interpolation gives you only the merged file with the variables left alone.

The docs have a specific warning about that second option. If you pipe the output back into docker stack deploy, always use --skip-interpolation. The reason given is that the output of the first step already has the variables filled in.

I’d use it as a review step, the swarm equivalent of docker compose config. The caveat is that interpolation uses the environment variables of your current shell, so the output can differ from one terminal to the next.

Further reading: docker stack config

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link