M HYPE SPLASH
// general

There is no top command in docker container

By Emily Wilson

I try to deploy an app in docker container using image that need to have top command

when I try to run top command the following result shown:

bash: top: command not found

how can I install top command?

2 Answers

I try to run following command inside docker container to search top command

$ apt-file search --regexp '/top$'

The result:

broctl: /usr/share/broctl/scripts/helpers/top
crossfire-maps: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
crossfire-maps-small: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
liece: /usr/share/emacs/site-lisp/liece/styles/top
lxpanel: /etc/xdg/lxpanel/two_panels/panels/top
open-infrastructure-container-tools: /usr/lib/open-infrastructure/container/top
procps: /usr/bin/top
quilt: /usr/share/quilt/top

so I try to install procps using following command inside the docker container

$ apt install procps
2

Its probably intentional - the docker philosophy is pretty much one application/process a container with whatever it needs to run.

You're unlikely to need a full set of userland tools in a container. If you do need to inspect the container itself, you can use docker top from the system running the docker instance instead.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy