When using the debian:stretch
Docker image, the /usr/share/man/
directory already contains many manpages, and man
can be easily installed to view them:
$ apt-get update
$ apt-get install man
$ man ls
$ man cp
However, when using the debian:stretch-slim
Docker image, the /usr/share/man/
directory is intentionally empty:
These tags are an experiment in providing a slimmer base (removing some extra files that are normally not necessary within containers, such as man pages and documentation)
How do I populate the /usr/share/man/
directory, so I can use man
to view manpages for core utilities (such as cat
, chmod
, chown
, cp
, ls
, mkdir
, mv
, rm
, tail
, etc) ?
Best Answer
The
coreutils
package populates the/usr/share/man/man1/
directory with manpages for core utilities.However, simply running
apt-get update
andapt-get install coreutils
is not sufficient, becausedpkg
has been configured to exclude/usr/share/man/*
, usingpath-exclude
in/etc/dpkg/dpkg.cfg.d/docker
(see here and here).So the first step is to remove that line from the
/etc/dpkg/dpkg.cfg.d/docker
file. One way to do this is by usingsed
:dpkg
has also been configured to exclude/usr/share/groff/*
, and this needs to be undone too (sincegroff
is required in order to render manpages):Now the
/usr/share/man/man1/
directory needs to be populated from thecoreutils
package. Sincecoreutils
is already installed in thedebian:stretch-slim
Docker image, it needs to be reinstalled:Finally,
man
can be installed and manpages can be viewed:It's also helpful to install
less
, whichman
will use for paginating the manpages, and provides a better experience than the defaultmore
paginator:Related questions: