Monday, April 18, 2022

ps command doesn't work in docker container

I want to do a ps command in a docker container derived from Debian official Docker hub repository:


$ docker run -ti debian:wheezy /bin/bash

root@51afd6b09af8:/# ps

bash: ps: command not found


alternative 1:

use docker top

docker top <container ID>


alternative 2 (but your container will be bloated):


ps is not installed in the base wheezy image. Try this from within the container:


apt-get update && apt-get install procps

or add the following line to the Dockerfile:

RUN apt-get update && apt-get install -y procps && rm -rf /var/lib/apt/lists/*

0 comments:

Post a Comment