How do you troubleshoot secrets?

I’m trying to set up a couple of containers using compose with secrets.

For the most part it seems to be working. But I have one specific case where I store secret with password for smtp in txt file. When I try to pass it via secrets system it does not work… But when I copy the password and pass it in the compose file directly it passes.

Which leads me to believe I do not understand something or I’m doing something wrong. How do you troubleshoot such cases? How do you check what’s actually being passed through?

Docker secrets are mounted as files in containers (doc), it requires Docker Swarm.

You can try to use a shell inside the container and cat the file to see the content.
docker exec -it <c-id> sh

ok, so I see the file is being mounted (no Swarm, I use it via docker compose). But how do you actually make use of it inside compose file? So for example how do I use contents of /run/secrets/db_password to actually pass a password for a service running in the container (MySQL for example)?

Usually the containers have special env variables, like ROOT_PASSWORD_FILE, check the docs.