EXEC command is used to run a second command in an already running docker container. When a docker container is started by means of START or RUN commands, we optionally specify a startup command which is the first command that is executed as soon as the container starts up. During scenarios where we would want to run another command on the already running container, we use the EXEC command along with the command to run.
> docker exec -it c669abe2068a bash
In the above example, the EXEC command runs a "bash" command on the running container resulting in opening a bash terminal.
Docker Posted May 17, 2020