Convert docker run commands into clean docker-compose.yml files.
Paste any docker run or docker create command with multiline backslashes, flags, ports, volumes, and env vars.
services:
my-postgres:
image: postgres:16-alpine
container_name: my-postgres
restart: unless-stopped
ports:
- "5432:5432"
volumes:
- "pgdata:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=appuser
- POSTGRES_PASSWORD=secretpassword
- POSTGRES_DB=appdb
volumes:
pgdata:docker run commands are great for quick one-off container tests. However, once you add port mappings, persistent volumes, environment variables, restart policies, and custom network rules, a single command can stretch across a dozen lines of bash with fragile backslashes.
Converting your commands into a docker-compose.yml file gives you several key advantages:
docker compose up -d..env files rather than pasting plaintext passwords into terminal history.Docker supports two main storage types:
pgdata:/var/lib/postgresql/data): Managed by the Docker engine, stored in Docker's internal directory, and shared across containers. This tool automatically declares them in the root volumes: section../html:/usr/share/nginx/html): Directly mapped to specific host paths. These do not require root volume declarations.Modern Docker Compose (v2 CLI) follows the official Compose Specification where top-level version: keys are deprecated and optional. By default, this tool outputs clean, modern Compose YAML. You can also toggle the version: '3.8' header if your CI/CD runner relies on legacy Compose v1.
More tools you might find useful
Convert Unix timestamps to dates and back, in UTC or local time.
Paste Q&A pairs, get copy-ready FAQPage JSON-LD schema markup.
Tokenizer-based GraphQL beautify and minify for queries and SDL schemas.
Generate SHA-256 and SHA-1 hashes from text.