.env · transform

ENV to Docker

Convert .env files to docker-compose env blocks, Dockerfile ENV instructions, or Kubernetes Secret YAML. Handles docker env file syntax automatically.

Be the first to rate
services:
  app:
    environment:
      DATABASE_URL: postgres://user:pass@db:5432/app
      PORT: 3000
      NODE_ENV: production
      JWT_SECRET: xxxxxxx

What it does

  • docker-compose environment block output
  • Dockerfile ENV directives
  • Kubernetes Secret manifest with base64 values
  • Preserves quotes and multi-word values
  • 100% client-side

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

Usage examples

Case 1 · docker-compose
DATABASE_URL=postgres://db/app
PORT=3000
services:
  app:
    environment:
      DATABASE_URL: "postgres://db/app"
      PORT: 3000
Case 2 · Dockerfile
NODE_ENV=production
PORT=3000
ENV NODE_ENV=production
ENV PORT=3000
Case 3 · Kubernetes Secret
JWT_SECRET=abc123
API_KEY=xyz
apiVersion: v1
kind: Secret
metadata:
  name: app-env
type: Opaque
data:
  JWT_SECRET: YWJjMTIz
  API_KEY: eHl6

When to use this tool

  • Migrating local .env to docker-compose.yml without hand-typing
  • Scaffolding a Kubernetes Secret from an existing .env
  • Converting a .env into a Dockerfile with baked-in ENV
  • Generating Helm chart values from existing config

Common mistakes

  • Assuming Kubernetes Secret base64 is encryption — it's not (see our env vs K8s compare)
  • Putting secrets into Dockerfile ENV — they land in the image and leak to registries
  • Hardcoding values in docker-compose when env_file: would be cleaner
  • Forgetting that docker-compose variable substitution uses ${VAR}, not $VAR, for clarity

Convert .env to Docker / Kubernetes

When moving from local development to containers, .env files become docker-compose blocks or Kubernetes Secret manifests. Paste your .env and pick a target — the converter renders the correct YAML or Dockerfile syntax instantly.

Frequently asked questions

Which Docker output formats are supported?

Three formats: (1) docker-compose environment block under services.app.environment, (2) Dockerfile ENV directives, and (3) Kubernetes Secret manifest with base64-encoded values.

Are my values visible in the Docker image when I use Dockerfile ENV?

Yes — ENV values baked into a Dockerfile are stored in the image layers and visible to anyone who pulls or inspects the image. For secrets, prefer --env-file at runtime, Docker secrets, or Kubernetes Secrets instead of Dockerfile ENV.

Does the tool handle values with special characters?

Yes. Values containing spaces, quotes, or special characters are automatically quoted in docker-compose output. For Kubernetes Secrets, all values are base64-encoded which eliminates special character issues.

Is Kubernetes Secret base64 encryption?

No. base64 is encoding, not encryption. Kubernetes Secrets are stored in etcd and are only as secure as your cluster's RBAC configuration. For production, enable etcd encryption at rest and restrict Secret access with RBAC policies.

Related tools

Learn more

Compare

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.