DevOps

.env to Docker Compose Converter

Paste a .env file and get the equivalent environment block ready to drop into a docker-compose.yml service.

Did this tool save you some time? A quick testimonial helps a lot.

Share your experience

About this .env to Docker Compose Converter

Paste a .env file and get the equivalent environment block ready to drop into a docker-compose.yml service. Common questions — like does this replace validating against my actual cluster/ci — are answered in the FAQ below.

Usage and privacy

How to use it

Add your input to the workspace above, review the result, then copy or download it when it's ready. No account or installation is required.

Private by design

.env to Docker Compose Converter runs in your browser, so the information you enter stays on your device instead of being uploaded to a server.

.env to Docker Compose Converter examples

A few worked examples so you know what to expect before you paste in your own input.

Simple .env file (list format)

Input

NODE_ENV=production
PORT=3000

Output

services:
  app:
    environment:
      - NODE_ENV=production
      - PORT=3000
Map format

Input

DATABASE_URL=postgres://user:pass@db:5432/app

Output

services:
  app:
    environment:
      DATABASE_URL: "postgres://user:pass@db:5432/app"
Comments and blank lines are ignored

Input

# App config
NODE_ENV=production

DEBUG=false

Output

services:
  app:
    environment:
      - NODE_ENV=production
      - DEBUG=false

Frequently Asked Questions

Related Tools