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
1
  • You need to install the manpages package if you want to have manpages available. Commented Jan 11, 2019 at 20:14

2 Answers 2

27

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
Sign up to request clarification or add additional context in comments.

1 Comment

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
12

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

2 Comments

That is not simple, how I press "Y" inside docker file?
For me, it needs to install man-db after unminimize: root# apt install man-db

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.