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: run docker compose config before you blame your compose file

Docker
~/tips/docker-compose-config

docker compose config

Prints the compose file as Docker really reads it, so you can find the mistake.

Before I edit a compose file a third time and hope for the best, I’d run one command first. docker compose config reads the file, fills in every variable, merges any extra files and prints what Docker will actually use. That is often not what you thought you wrote.

docker compose config

The output is the canonical version of your setup, with short syntax expanded. If a port, a path or an image tag looks wrong here, it was wrong before you started the container. It is a good place to catch a ${VARIABLE} that comes from a different .env file than you expected.

Two flags I’d remember. -q checks the file and prints nothing, which makes it a quick yes or no before docker compose up -d. --services lists just the service names, one per line.

docker compose config -q
docker compose config --services

One caveat: the output has your variables filled in, so passwords and API keys from your .env show up in plain text. Look at it, but don’t paste it into a forum thread or a chat as is. If you want to see the file without the substitution, --no-interpolate skips it, according to the Docker docs.

If you run containers on Unraid or a home server and edit compose files by hand, this takes ten seconds and saves a lot of staring.

Further reading: Docker docs: docker compose config, On this site: docker compose run –rm gives you a one-off command that cleans up after itself, On this site: docker compose logs –since 10m shows only what just happened, On this site: Guide: check a Docker Compose file with docker compose config before you start anything

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