docker exec | docker run bash
RunacommandinarunningcontainerUsage$dockerexec[OPTIONS]CONTAINERCOMMAND[ARG...]Refertotheoptionssection[1]foranoverviewofavailableOPTIONS[2]forthiscommand.DescriptionThedockerexeccommandrunsanewcommandinarunningcontainer.Thecommandstartedusingdockerexeconlyrunswhilethecontainer’sprimaryprocess(PID1)isrunning,anditisnotrestartedifthecontainerisrestarted.COMMANDrunsinthedefaultdirectoryofthecontainer.IftheunderlyingimagehasacustomdirectoryspecifiedwiththeWORKDIRdirectiveinitsDockerfile,thisdir...
Run a command in a running container
Usage $ docker exec [OPTIONS] CONTAINER COMMAND [ARG...]Refer to the options section[1] for an overview of available OPTIONS[2] for this command.
DescriptionThe docker exec command runs a new command in a running container.
The command started using docker exec only runs while the container’s primary process (PID 1) is running, and it is not restarted if the container is restarted.
COMMAND runs in the default directory of the container. If the underlying image has a custom directory specified with the WORKDIR directive in its Dockerfile, this directory is used instead.
COMMAND must be an executable. A chained or a quoted command does not work. For example, docker exec -it my_container sh -c "echo a && echo b" works, work, but docker exec -it my_container "echo a && echo b" does not.
For example uses of this command, ...