In Docker, 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.
But there could be scenarios where we would want to run another command on the already running container, or we may want to do a shell into the container (for debug purpose e.g)
In such cases we use the docker 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.
The flags i and t along with the command represent “input” and output to terminal respectively.