docker-compose run <service> <command>

Run a one-off command on a service

Arguments

NameDescription
service
command

Options

NameDescription
--detach, -dRun container in background and print container ID
--entrypoint <entrypoint>Override the entrypoint of the image
--env, -e <env>
  • Repeatable ♾
--interactive, -iKeep STDIN open even if not attached
--label, -l <label>
  • Repeatable ♾
--name <name>Assign a name to the container
--no-TTY, -TDisable pseudo-TTY allocation (default: auto-detected)
--no-depsDon't start linked services
--publish, -p <publish>
  • Repeatable ♾
--quiet-pullPull without printing progress information
--rmAutomatically remove the container when it exits
--service-portsRun command with the service's ports enabled and mapped to the host
--tty, -tAllocate a pseudo-TTY
--use-aliasesUse the service's network useAliases in the network(s) the container connects to
--user, -u <user>Run as specified username or uid
--volume, -v <volume>
  • Repeatable ♾
--workdir, -w <workdir>Working directory inside the container