Complete the command to run a shell inside a running container named 'webapp'.
docker exec -it [1] /bin/bashThe docker exec command requires the container name or ID to specify where to run the command. Here, 'webapp' is the container name.
Complete the command to list files inside the container 'db' in the '/var/log' directory.
docker exec [1] ls /var/logThe container name 'db' is needed to tell Docker where to run the ls command.
Fix the error in the command to run 'env' inside container 'app1' interactively.
docker exec [1] app1 env-d which runs the command detached and does not allow interaction.--rm which is for removing containers after run, not exec.The -it option allows interactive terminal access, which is needed to run commands interactively inside the container.
Fill both blanks to run 'cat /etc/hosts' inside container 'backend' with a pseudo-TTY and keep STDIN open.
docker exec [1] [2] cat /etc/hosts
-d which detaches and does not allow interaction.The container name 'backend' is needed to specify where to run the command. The -it option allows interactive terminal access.
Fill all three blanks to run 'echo Hello' inside container 'frontend' interactively and detach after execution.
docker exec [1] [2] [3] echo Hello
--rm which is not valid for exec.The container name is 'frontend'. The -it option allows interactive terminal, and -d runs the command in detached mode.