Skip to content

.env → Docker Compose

Paste a .env / dotenv file or upload one, then convert KEY=VALUE pairs into a Docker Compose environment: block (YAML list or map). Optionally wrap a minimal services.app snippet. Everything runs in your browser — nothing is sent to a server.

.env to Docker Compose controls

or paste below

How it works

Paste a dotenv-style file or upload a .env / text file. The converter reads KEY=VALUE lines, optional export prefixes, quotes, comments, and empty values, then builds a Compose-ready environment: YAML block you can paste into docker-compose.yml or Compose specs.

Choose list style (- KEY=value) or map style (KEY: value), decide whether values with spaces or special characters are quoted, strip export, and optionally wrap a minimal services.app snippet with a placeholder image.

Parsing is pure client-side JavaScript — handy when a .env has secrets you do not want to post to a remote converter. Use Load sample to preview, then Clear when finished.

When to use this tool

Tips

Frequently asked questions

How do I turn a .env into Docker Compose environment variables?

Paste or upload your .env, choose list or map YAML style, then copy the generated environment: block into docker-compose.yml. Optionally wrap it in a minimal services.app snippet.

Does my .env leave my browser?

No. Parsing runs entirely in your browser with JavaScript. Your .env contents are not uploaded to a server. Prefer local tools for production secrets when possible.

List style vs map style — which should I use?

List style uses - KEY=value under environment: (common in Compose examples). Map style uses KEY: value. Both are valid in Docker Compose; pick the style your team already uses.

Is this .env to Docker Compose converter free?

Yes. The Formattly .env to Docker Compose converter is free to use with no signup required.

What does Full compose snippet do?

When enabled, output is wrapped in a minimal services.app block with a placeholder image and the environment: keys nested under it. When disabled, you get only the environment: block to paste into an existing service.