Two artefacts exist whenever you share a Compose file: the one you wrote, and the one a tool renders after substituting variables. The second is often more sensitive than the first, and it is the one people paste into an issue without reading. Reviewing only the source file is reviewing the wrong document.

Compare what each copy can contain before deciding what to remove.

The Rendered Model Is a Different Document

Compose resolves environment variables, merges override files and produces an effective configuration that a reader can no longer distinguish from hand-written values. A reference such as a variable name in the source becomes the account token itself in the output. The structure that makes the file useful for diagnosis survives that transformation; so does everything that should never have been in it.

Render the file yourself before you attach it, and treat that output as the artefact under review. If you cannot render it, you cannot know what you are about to publish.

Secrets Sit in More Places Than the Key Field

Start with the obvious: private keys, preshared keys, tokens, passwords and connection URLs that embed credentials. Then look at everything the file points to, because a reference is not a redaction. An env file mounted into the service, a configuration file bind-mounted from the host, a label carrying a token, and a command argument that includes a password all travel with the deployment even when the YAML looks clean. A key pasted into a variable with a reassuring name is still a key.

Host paths and service names leak a second kind of information. A home directory name, an internal hostname or a network range can identify a person or an organization without containing a single credential, and that context is worth removing for the same reason.

A Secret Declaration Is Not the Secret

Compose secret objects separate the declaration from the material: the service gets a path or a target, and the content lives elsewhere. Keeping the declaration while replacing the material is usually the right trade, because the reviewer needs to see that a secret exists and how it is mounted. What must not survive is the content itself.

Labels and comments deserve the same treatment. A comment that says which vault path holds the production key tells an attacker where to look even though it contains no key.

Keep the Shape So the File Still Diagnoses

Redaction that removes the network mode, the image version or the capability settings produces a file nobody can debug with. Replace the sensitive values and keep the relationships: which service mounts what, which network it joins, which device it needs. That is the part a reader uses to explain a missing route or an unavailable device. It is also the version a colleague can compare against their own working deployment.

docker compose -f compose.yaml config > rendered.yaml
grep -nE 'PRIVATE_KEY|PASSWORD|TOKEN|PSK|PrivateKey|passphrase' rendered.yaml
wc -l rendered.yaml

Do not deploy the redacted copy as if it were the working original. It is a description, and a description that has been edited to look safe will fail in ways that look like configuration bugs.

If Material Was Exposed, Replace It

Removing the attachment does not remove the copies other people already made, and mirrors and caches keep their own. Use the issuer's revocation and replacement process for whatever leaked, then update the deployment. That order matters, because replacing first and revoking later leaves a window with two valid credentials.

For support threads, lead with the exact error, the image version, the network mode and the one non-secret setting that matters. That combination explains a missing device or a broken route far more often than the key does.

פֿאַרבונדענע אַרטיקלען