0
0
Dockerdevops~10 mins

Executing commands with docker exec - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to run a shell inside a running container named 'webapp'.

Docker
docker exec -it [1] /bin/bash
Drag options to blanks, or click blank then click option'
Awebapp
Brun
Cbuild
Dimage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'build' instead of the container name.
Forgetting to specify the container name.
2fill in blank
medium

Complete the command to list files inside the container 'db' in the '/var/log' directory.

Docker
docker exec [1] ls /var/log
Drag options to blanks, or click blank then click option'
A-d
B-it
Ccontainer
Ddb
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like '-it' or '-d' instead of the container name.
Using the word 'container' instead of the actual container name.
3fill in blank
hard

Fix the error in the command to run 'env' inside container 'app1' interactively.

Docker
docker exec [1] app1 env
Drag options to blanks, or click blank then click option'
A-it
B-d
C--rm
D-p
Attempts:
3 left
💡 Hint
Common Mistakes
Using -d which runs the command detached and does not allow interaction.
Using --rm which is for removing containers after run, not exec.
4fill in blank
hard

Fill both blanks to run 'cat /etc/hosts' inside container 'backend' with a pseudo-TTY and keep STDIN open.

Docker
docker exec [1] [2] cat /etc/hosts
Drag options to blanks, or click blank then click option'
A-it
B-d
Cbackend
D--rm
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of container name and options.
Using -d which detaches and does not allow interaction.
5fill in blank
hard

Fill all three blanks to run 'echo Hello' inside container 'frontend' interactively and detach after execution.

Docker
docker exec [1] [2] [3] echo Hello
Drag options to blanks, or click blank then click option'
A-it
Bfrontend
C-d
D--rm
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of options and container name.
Using --rm which is not valid for exec.