Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get 'man' working in an Alpine Linux Docker container?

I can’t get man to work in an Alpine Linux Docker container.

Pull Alpine Linux and start a container.

docker pull alpine:latest
docker run -t -i alpine /bin/ash

Update repository indexes from all remote repositories.

apk update

Install man and man-pages.

apk add man man-pages

Install a package and its documentation.

apk add curl
apk add curl-doc

Try to view the man pages.

/ # man curl
/usr/share/man/mandoc.db: No such file or directory
man: outdated mandoc.db lacks curl(1) entry,
     consider running  # makewhatis /usr/share/man
more: -s: No such file or directory
/ # 

What?


Update

Following @EugenMayer’s advice to add mdicml-apropos, I can get curl --manual to work but not man curl. Unfortunately, gnupg --manual doesn’t work at all. This behaviour is inconsistent and unexpected.

like image 399
lukejanicke Avatar asked Aug 20 '16 14:08

lukejanicke


3 Answers


This seems a pretty old question, however I'm going to post my answer anyway, maybe it could be useful for someone else in the future.
I tried the solution for Alpine Linux v3.15 Docker container and it works.

Steps to reproduce:

  1. docker pull alpine:3.15

  2. docker run --rm --name alpine -it alpine:3.15 /bin/sh

  3. apk add curl

  4. apk add curl-doc

  5. typing man curl, you will obtain the following error:

    /bin/sh: man: not found
    
  6. In order to resolve the above error, type: apk add mandoc man-pages

  7. You should be able to view and browse the curl's manual page!

In case you still face an error, type the following command: export PAGER=less and then try to look curl's manual page up again.

Additional resources: Install man in an alpine linux docker container

like image 184
Luca Oddone Avatar answered Nov 06 '22 06:11

Luca Oddone


You need to add

apk add mdocml-apropos

and then for each package you need the man packages for

apk add curl-doc

and you are set to go to use man after, like you already did

apk add man man-pages mdocml-apropos

The source for this (plus added the mdocml-apropos which is missing there) is https://wiki.alpinelinux.org/wiki/Alpine_Linux:FAQ#Why_don.27t_I_have_man_pages_or_where_is_the_.27man.27_command.3F but interstingly, i cannot get it working myself.

Also tried to export TERM=xterm to see if thats in iteractivity issue but it is not.

Also tried makewhatis /usr/share/man manually, but no sucess.

Interestingly though:

ls  -la /usr/share/man/man1/curl-config.1.gz
-rw-r--r--    1 root     root          1687 Aug  4 15:07 /usr/share/man/man1/curl-config.1.gz

So there is a manpage

like image 32
Eugen Mayer Avatar answered Nov 06 '22 07:11

Eugen Mayer


For me, to get rid of this error:

man man
more: -s: No such file or directory

I use:

export PAGER=less

then it works

like image 5
Rodrigo Gomez Avatar answered Nov 06 '22 06:11

Rodrigo Gomez