I have docker image starting from python:3.10-slim.
As the container running (name container_a), I would like to check the process running inside the container.
- docker top container_a: I am able to see three threads.
- docker exec container_a ps: executable not found in $PATH
- docker exec -it container_a sh: I am able to enter inside the container, and again I could not find ps or top under /bin
Anyone knows other command to list the process?
Thank you very much!
I have tried search command to list processes in Linux. It seems that both ps and top are common ones but neither works in the Slim linux.
As highlighted by other comments, -slim
tags are meant to, well, be slim. That images contain just what the main application needs to work, not what you need for interactive use. If you really want to, try:
docker run -it python:3.10-slim sh
apt update && apt install procps
ps
This adds a few megabytes to the original image. To retain changes, use docker tag
or docker commit
, or a custom Dockerfile that RUN
s previous apt commands
Does this answer your question? ps command doesn’t work in docker container
The point of
slim
is that it only includes a very “slim” set of utilities, and apparently that does not includeps
. You’ll have to install it like in the linked duplicate, or usedocker top
.There’s probably only one process, whatever your Dockerfile specified as its
CMD
. What is your goal with this?