appsettings.json to Docker Compose environment

Convert appsettings.json to a Docker Compose environment block for .NET containers. Generate YAML with double-underscore keys and escaped dollar signs locally.

Environment variables
Your result shows up here
Waiting for inputProcessed locally in your browser

Place the environment block under your Compose service

Paste the generated environment block under the service that runs your .NET application, with the matching YAML indentation. Values stay quoted strings. The converter doubles literal dollar signs so Compose does not treat them as interpolation. Use Compose secrets or another secret store for sensitive production values.

How .NET maps settings to environment variables

Logging__LogLevel__Default

Sections

Every level of nesting becomes a double underscore, because a colon does not work in environment variable names on every platform.

Cors__Origins__0

Arrays

Each item of an array gets its position as a key, starting at 0.

LOGGING__LOGLEVEL__DEFAULT

Overrides

.NET reads environment variables after appsettings.json, so they replace its values. Names are not case sensitive.

MYAPP_Jwt__Issuer

Prefix

With AddEnvironmentVariables("MYAPP_"), .NET reads only the variables that start with the prefix and drops the prefix from the name.

Read more in the Microsoft documentation

Everything runs locally in your browser. What you paste is never uploaded or saved, so passwords and keys stay on your machine.