docker | docker compose command args
Runaone-offcommandonaservice.Usage$dockercomposerun[OPTIONS]SERVICE[COMMAND][ARGS...]Refertotheoptionssection[1]foranoverviewofavailableOPTIONS[2]forthiscommand.DescriptionRunsaone-timecommandagainstaservice.thefollowingcommandstartsthewebserviceandrunsbashasitscommand:$dockercomposerunwebbashCommandsyouusewithrunstartinnewcontainerswithconfigurationdefinedbythatoftheservice,includingvolumes,links,andotherdetails.However,therearetwoimportantdifferences:First,thecommandpassedbyrunoverridesthe...
Run a one-off command on a service.
Usage $ docker compose run [OPTIONS] SERVICE [COMMAND] [ARGS...]Refer to the options section[1] for an overview of available OPTIONS[2] for this command.
DescriptionRuns a one-time command against a service.
the following command starts the web service and runs bash as its command:
$ docker compose run web bashCommands you use with run start in new containers with configuration defined by that of the service, including volumes, links, and other details. However, there are two important differences:
First, the command passed by run overrides the command defined in the service configuration. For example, if the web service configuration is started with bash, then docker compose run web python app.py overrides it with python app.py.
The second difference is that the docker compose run command does not create any of the ports specifie...