0
0
Dockerdevops~20 mins

Why interacting with containers matters in Docker - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
πŸŽ–οΈ
Container Interaction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why do we need to interact with running containers?

Which of the following best explains why interacting with running containers is important in DevOps?

ATo monitor and debug applications inside containers in real time.
BTo permanently change the container image stored in the registry.
CTo increase the container size for more storage automatically.
DTo convert containers into virtual machines for better performance.
Attempts:
2 left
πŸ’‘ Hint

Think about what you might do if an app inside a container is not working as expected.

πŸ’» Command Output
intermediate
2:00remaining
Output of docker exec command

What will be the output of the following command if the container named webapp is running and has a file /app/version.txt containing 'v1.2.3'?

Docker
docker exec webapp cat /app/version.txt
Av1.2.3
BError: No such file or directory
CContainer webapp not found
DPermission denied
Attempts:
2 left
πŸ’‘ Hint

Consider what docker exec does when running a command inside a container.

πŸ”€ Workflow
advanced
2:00remaining
Correct sequence to interact with a container shell

What is the correct order of commands to start a container named db if stopped, then open an interactive shell inside it?

A1,3,2,4
B3,1,2,4
C1,2,3,4
D3,2,1,4
Attempts:
2 left
πŸ’‘ Hint

Think about checking container status before starting and interacting.

❓ Troubleshoot
advanced
2:00remaining
Why does docker exec fail with 'No such container'?

You run docker exec myapp ls but get the error 'Error: No such container: myapp'. What is the most likely cause?

AYou do not have permission to run docker commands.
BThe 'ls' command is not installed inside the container.
CThe container named 'myapp' is not running or does not exist.
DDocker daemon is not running on the host machine.
Attempts:
2 left
πŸ’‘ Hint

Consider what the error message says about the container name.

βœ… Best Practice
expert
2:00remaining
Best practice for persistent data when interacting with containers

Which option describes the best practice to keep data safe and persistent when interacting with containers that may be stopped or removed?

ACopy data to a temporary folder inside the container before stopping it.
BSave data inside the container’s writable layer and commit changes to the image.
CRely on container snapshots to restore data after removal.
DUse Docker volumes or bind mounts to store data outside the container filesystem.
Attempts:
2 left
πŸ’‘ Hint

Think about how container filesystems behave when containers are deleted.