From a one-liner to a file
A long docker run command works, but it lives in someone's shell history. The moment a container matters; it should restart on boot, a colleague needs to reproduce it, it grows a second service, the flags belong in a docker-compose.yml under version control. This converter does the mechanical translation: -p becomes ports, -v becomes volumes, -e becomes environment, --restart, --network, resource limits, capabilities and devices all map to their compose keys, and anything it can't translate is flagged rather than silently dropped.
The details worth knowing
Port mappings are emitted quoted ("8080:80") because unquoted, YAML can interpret xx:yy as a base-60 number, an infamous compose gotcha. -d disappears because detaching is how docker compose up -d works, not a container property. --rm has no equivalent, since compose-managed containers are meant to persist. A custom --network is emitted as an external network reference; drop the external: true if you'd rather compose create it.
Why compose even for one container
Beyond reproducibility: docker compose up -d after editing the file performs a clean recreate with the new settings, the file documents intent in code review, and adding a database or reverse proxy later is three lines instead of a second fragile one-liner. If you manage the host with configuration management, the compose file is also the natural artifact to template and deploy, a shell command is not.