Convert docker run Commands to compose.yaml with Dockge

docker run command converting into a compose.yaml file

Half the READMEs on the internet still hand you a long docker run command. Dockge's built-in converter turns that one-liner into a tidy compose.yaml service, ready to deploy as a managed stack.

Where the converter lives

Open the Dockge home screen. The converter box sits front and centre: paste a docker run command on the left and the compose equivalent appears instantly.

A real example

Take this typical command:

docker run -d \
  --name uptime-kuma \
  -p 3001:3001 \
  -v ./data:/app/data \
  --restart unless-stopped \
  louislam/uptime-kuma:1

Dockge converts it into:

services:
  uptime-kuma:
    container_name: uptime-kuma
    image: louislam/uptime-kuma:1
    restart: unless-stopped
    ports:
      - 3001:3001
    volumes:
      - ./data:/app/data

From there, one click turns the output into a new stack folder in /opt/stacks, and you deploy it like any other stack (see the stack management tutorial).

What gets mapped

  • -pports
  • -vvolumes
  • -eenvironment
  • --restartrestart
  • --namecontainer_name
  • --networknetworks

Cleanup tips after converting

  • Pin an explicit image tag instead of latest for predictable updates.
  • Move secrets out of inline environment lines and into an .env file.
  • Drop container_name if you plan to scale the service — compose names containers sensibly on its own.

The converter is one of the fastest ways to migrate an old collection of run commands into managed, version-controllable stacks.

Review generated YAML before deploying it

A converter can translate common flags, but it cannot decide whether the original command is secure or maintainable. Check image tags, volume paths, published ports, restart policy, environment variables, capabilities and network settings before clicking deploy.

Do not paste secrets into examples or public tools

If a docker run command contains passwords, API tokens or private registry credentials, remove or replace them before sharing the command. Prefer environment files, Docker secrets where appropriate, or another secret-management method rather than committing credentials into compose.yaml.

After conversion

docker compose config

Running docker compose config from the stack directory is a useful syntax and interpolation check before deployment. It does not prove the application configuration is correct, but it catches many malformed Compose definitions.

What usually maps cleanly

Common docker run options such as published ports, bind mounts, named volumes, environment variables, restart policies, container names and basic network settings usually have direct Compose equivalents. The generated file is still a starting point rather than a security review.

Pay special attention to privileged mode, host networking, device mappings, Linux capabilities and Docker socket mounts. Those options can grant extensive host access and should not be copied into a Compose stack merely because the original one-line command used them.

Official references

Technical details in this guide are checked against upstream sources. Verify release-sensitive commands before changing a production host.