.env to docker-compose Converter

This .env to docker-compose converter parses a standard .env file and generates both a ready-to-paste environment: block and a full single-service docker-compose.yml skeleton. Everything runs client-side, which matters since .env files often hold real secrets.

How to use it

Paste the contents of your .env file, optionally set a service name, and click Convert. You'll get two outputs: just the environment: list (for pasting into an existing compose file) and a complete skeleton with a placeholder image field, ready to fill in.

What gets parsed

Each non-empty, non-comment line is split on its first =. A leading export keyword is stripped (common when a .env file is also meant to be sourced in a shell), and matching surrounding quotes around the value are removed. Malformed lines without an = are skipped rather than breaking the whole conversion.

Why list-style environment blocks

Docker Compose supports both a map (KEY: value) and a list (- KEY=value) syntax for environment variables. This tool outputs list style because it handles values containing colons — like URLs and connection strings — without needing extra YAML quoting.

.env to docker-compose Converter Pro

Pro version coming soon — batch validation via CSV upload, exportable results, API access, and an offline version. The free tool stays free.

Pro version coming soon

Batch validation via CSV upload, exportable results, API access, and an offline version are on the way. The free tool stays free.

Frequently asked questions

Why not just use env_file: in docker-compose.yml?

You often can, and for local development that's simpler. This tool is for the cases where you need the variables inlined directly into the compose file — e.g. generating a skeleton to hand off, templating multiple environments, or when a tool you're integrating with doesn't support env_file.

Does it handle quoted values and comments?

Yes. Lines starting with # are treated as comments and skipped, blank lines are ignored, an optional leading "export " is stripped, and surrounding single or double quotes around a value are removed.

What if a value itself contains an equals sign?

Only the first "=" on each line is treated as the key/value separator, so values like DATABASE_URL=postgres://user:pass@host:5432/db work correctly.

Is my .env file uploaded anywhere?

No — parsing happens entirely in your browser with JavaScript. Nothing is sent to a server, which matters since .env files often contain secrets.

Can I generate more than one service?

This tool generates a single-service skeleton to get you started quickly. For multi-service setups, generate the environment: block for each service separately and paste them into your compose file under the right service.