Skip to content

Docker Run to Docker Compose Converter

Convert a docker run command into an equivalent docker-compose.yml service definition.

Category: development
Use Case: Migrating a Manual docker run to Compose, Documenting a Container's Configuration, Standardizing Local Dev Environments
Privacy: 100% browser-based

This covers the most common docker run flags (-p, -v, -e, --name, --network, --restart, -d) - less common or advanced flags aren't translated and will be ignored.

docker run command

docker-compose.yml

Recommended Settings

Pro Tips

  • The generated service name is derived from --name if provided, otherwise from the image name itself
  • The -d/--detach flag doesn't need translation since Compose services run detached by default when started with docker compose up -d
  • Multiple -p, -v, or -e flags are all collected and listed under their respective ports, volumes, or environment sections
  • Review the generated YAML before using it in production - always double-check port mappings and volume paths translated correctly

Most Popular

Most people convert a database container's run command (like Postgres or Redis) into a reusable compose service definition

When to Use This Tool

Migrating a Manual docker run to Compose

Convert an ad hoc container command into a version-controlled compose service.

Documenting a Container's Configuration

Generate readable YAML documentation for how a container was originally run.

Standardizing Local Dev Environments

Turn a colleague's docker run command into a shareable compose file.

Learning Docker Compose Syntax

See how familiar docker run flags map to their Compose YAML equivalents.

How It Works

1

Tokenize the docker run command, correctly handling quoted arguments

2

Recognize common flags (-p, -v, -e, --name, --network, --restart, -d) and the trailing image name and command

3

Build an equivalent Compose service definition and serialize it as YAML

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Client-side command parsing and YAML serialization (js-yaml) for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

Does this support every docker run flag?

No, it covers the most commonly used flags (ports, volumes, environment variables, name, network, restart policy, and detach). Less common flags like resource limits or capability settings aren't translated.

Will the generated compose file work exactly the same?

For the flags this tool recognizes, yes - but always review the output, since some docker run behaviors (like default networking) can differ subtly under Compose.

Can I add a version field to the compose file?

Modern Docker Compose no longer requires a top-level version field, so this tool omits it by default, following current best practice.

Is my command sent anywhere?

No. All parsing and YAML generation happens locally in your browser.