14

I use the following Dockerfile to build an image and start a container. But once I am in the container, I still can not find manpages. Does anybody know how to solve this problem?

$ cat Dockerfile 
FROM ubuntu
RUN apt -y update && apt -y upgrade
RUN apt-get -y install build-essential
RUN apt-get -y install vim
RUN apt-get -y install man
RUN apt-get -y install gawk
RUN apt-get -y install mawk

$ man man
No manual entry for man
See 'man 7 undocumented' for help when manual pages are not available.
$ find /usr/share/man /usr/local/share/man  -type f
janw
  • 8,758
  • 11
  • 40
  • 62
user1424739
  • 11,937
  • 17
  • 63
  • 152

2 Answers2

25

You need to make a change to your /etc/dpkg/dpkg.cfg.d/excludes within the container. You can do this in your Dockerfile with the following command:

RUN sed -i 's:^path-exclude=/usr/share/man:#path-exclude=/usr/share/man:' \
        /etc/dpkg/dpkg.cfg.d/excludes

Then make another update to your Dockerfile to install the man pages

RUN apt-get update && \
    apt-get install -y \
        man \
        manpages-posix
Oliver
  • 27,510
  • 9
  • 72
  • 103
Petek7
  • 251
  • 2
  • 3
  • 3
    Avoid `/` as sed delimiter when working with path: `sed -i 's,^path-exclude=/usr/share/man/,#path-exclude=/usr/share/man/,' /etc/dpkg/dpkg.cfg.d/excludes` – ryenus Aug 16 '19 at 08:58
10

There is a easier way to enable the MAN command.

In terminal, just execute the command below:

unminimize

It will ask if you like to continue [Y/n] Just press:

Y

It will take a while to finish all the processing.

After that, test this:

man man

Simple as that

Thanks to @kazushi

PedroPK
  • 519
  • 6
  • 8