Convert docker run commands to Docker Compose YAML or JSON, and translate multi-service docker-compose.yml files back into standalone docker run shell scripts locally in your browser.
Presets
1 line · 160 chars
160 / 50,000 UTF-16 code units · 160 UTF-8 bytes
100% browser-local POSIX parser
Converted docker run to valid Docker Compose YAML.
15 lines · 281 chars
THE DETAILS
Docker CLI flags to Compose directive mapping.
Docker CLI Flag
Compose Directive
Example YAML
-p, --publish
ports
- "8080:80"
-v, --volume
volumes
- pgdata:/var/lib/postgresql/data
-e, --env
environment
- NODE_ENV=production
--name
container_name
container_name: web
--restart
restart
restart: unless-stopped
--cpus, --memory
cpus, mem_limit
cpus: "1.5", mem_limit: 512m
--health-cmd
healthcheck.test
["CMD-SHELL", "curl -f http://localhost/"]
Frequently Asked Questions
How does Docker Run to Docker Compose conversion work?
The converter tokenizes your shell command using POSIX lexical parsing rules, extracts flags (ports, volumes, environment variables, resource limits, and health checks), and maps them into valid Docker Compose YAML or JSON.
Can I convert multiple docker run commands into a single multi-service compose file?
Yes. Paste multiple docker run commands separated by newlines (including multi-line backslash continuations). Each container becomes a service under services, and named volumes are automatically declared under top-level volumes.
Can I convert docker-compose.yml back into docker run commands?
Yes. Switch to "Compose → docker run" or click Swap ↔ to translate single- or multi-service Compose YAML/JSON into properly quoted docker run shell commands.
Are named volumes and environment dictionaries supported?
Yes. The converter handles both list syntax (-e KEY=val) and key-value dictionary syntax (KEY: val), and automatically detects named volume mounts like pgdata:/var/lib/postgresql/data.
Are my environment variables or secrets sent to a server?
Never. The lexical tokenizer and YAML parser execute 100% locally in your browser memory—no commands, passwords, or internal image names ever leave your device.