DevPulse

DevPulse is your go-to publication for cutting edge technical insights, tutorials, and industry…

Follow publication

Member-only story

Docker interview questions!

📌 How would you troubleshoot a Docker container that is stuck in an “Exited” state immediately after starting?

âś… First, check the logs of the container using docker logs <container_id>. The logs often provide clues about what went wrong.

âś… Check the exit code of the container using docker inspect <container_id> or docker ps -a.

âś… An exit code of 137 typically means the container was killed due to memory limits.

âś… Exit code 1 often means an application error, while 143 is typically a result of the container receiving a SIGTERM.

âś… If there are no obvious application errors, inspect the Dockerfile for issues with the ENTRYPOINT or CMD instructions. If these are incorrectly set or missing, the container will exit immediately.

âś… Verify if the host has enough system resources, such as CPU, memory, or disk space. You can check this with docker stats or docker system df.

đź“Ś You observe that a container is consuming an excessive amount of memory. How do you troubleshoot this?

âś… Use the docker stats command to check the live memory usage of containers.

âś… If the memory consumption is high, you might consider:

✅ Adding memory limits using – memory or – memory-swap flags when starting the container to restrict its memory usage.

✅ Check if there are memory leaks in the application by reviewing the application logs or…

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

DevPulse
DevPulse

Published in DevPulse

DevPulse is your go-to publication for cutting edge technical insights, tutorials, and industry trends. Stay ahead in the fast-paced world of development with in-depth articles on coding, software engineering, and the latest tech innovations. Tune into the pulse of technology!

Rsprasangi
Rsprasangi

Written by Rsprasangi

With 12 years in IT, I share cutting edge insights on tech, coding and innovation at DevPulse, driving the future of Software Engineering one article at a time.

No responses yet

Write a response