0
0
Dockerdevops~20 mins

Common container startup failures in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Container Startup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Identify the error from Docker container startup logs
You run a Docker container but it immediately stops. You check the logs with docker logs container_id and see this message:

standard_init_linux.go:228: exec user process caused: no such file or directory

What is the most likely cause of this error?
AThe command specified as ENTRYPOINT or CMD does not exist inside the container.
BThe container ran out of memory during startup.
CThe Docker daemon is not running on the host machine.
DThe container image is corrupted and cannot be loaded.
Attempts:
2 left
💡 Hint
Think about what the error means about the process Docker tries to start.
💻 Command Output
intermediate
2:00remaining
Diagnose container exit code after startup failure
You start a container and it exits immediately. Running docker ps -a shows the container exited with code 137.

What does exit code 137 usually indicate?
AThe container failed due to a syntax error in the Dockerfile.
BThe container was killed because it ran out of memory (OOM).
CThe container completed successfully and exited normally.
DThe container was stopped manually by the user.
Attempts:
2 left
💡 Hint
Exit code 137 is 128 + 9, where 9 is the SIGKILL signal.
Troubleshoot
advanced
2:00remaining
Resolve Docker container failing due to port binding error
You try to start a container with docker run -p 80:80 myapp but get this error:

Bind for 0.0.0.0:80 failed: port is already allocated

What is the best way to fix this issue?
ARestart the Docker daemon to clear port bindings.
BRebuild the container image to use a different internal port.
CStop the process currently using port 80 on the host or use a different host port for the container.
DIncrease the container's memory limit to allow port binding.
Attempts:
2 left
💡 Hint
Port conflicts happen when two processes want the same port on the host.
Best Practice
advanced
2:00remaining
Prevent container startup failure due to missing environment variables
Your containerized app requires environment variables to start properly. Sometimes the container fails immediately with configuration errors.

Which practice helps avoid startup failures caused by missing environment variables?
AUse Docker Compose or Kubernetes manifests to define required environment variables explicitly.
BStart the container without environment variables and set them later inside the container.
CIgnore environment variables and rely on default app settings only.
DHardcode environment variables inside the container image during build.
Attempts:
2 left
💡 Hint
Think about how to ensure environment variables are always set before container starts.
🔀 Workflow
expert
3:00remaining
Order the steps to debug a container that fails immediately after starting
You have a container that starts and then stops immediately. Put the following debugging steps in the correct order to find the root cause:
A3,1,4,2
B1,4,3,2
C1,3,4,2
D4,1,3,2
Attempts:
2 left
💡 Hint
Start with quick info about exit code, then logs, then config, then interactive inspection.