docker compose exec | Docker-compose enter container
Executeacommandinarunningcontainer.Usage$dockercomposeexec[OPTIONS]SERVICECOMMAND[ARGS...]Refertotheoptionssection[1]foranoverviewofavailableOPTIONS[2]forthiscommand.DescriptionThisistheequivalentofdockerexectargetingaComposeservice.Withthissubcommand,youcanrunarbitrarycommandsinyourservices.CommandsallocateaTTYbydefault,soyoucanuseacommandsuchasdockercomposeexecwebshtogetaninteractiveprompt.OptionsName,shorthandDefaultDescription--detach,-dDetachedmode:Runcommandinthebackground.--env,-eSete...
Execute a command in a running container.
Usage $ docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...]Refer to the options section[1] for an overview of available OPTIONS[2] for this command.
DescriptionThis is the equivalent of docker exec targeting a Compose service.
With this subcommand, you can run arbitrary commands in your services. Commands allocate a TTY by default, so you can use a command such as docker compose exec web sh to get an interactive prompt.
Options Name, shorthand Default Description --detach , -d Detached mode: Run command in the background. --env , -e Set environment variables --index 1 index of the container if there are multiple instances of a service [default: 1]. --interactive , -i true Keep STDIN open even if not attached. --no-TTY , -T true Disable pseudo-TTY allocation. By default docker compos...