How to get 'man' working in an Alpine Linux Docker container?
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
In fact, this has to do with the way you are connected to the container. I'm using alpine a lot with LXD, and generally can't read any man page when connected via lxc exec container ash
. I suppose docker connect you to the container the same way.
$ lxc exec alp03 ash~ # man manmore: -s: No such file or directory
So you can use su -
, and then you will be able to use man:
~ # su -alp03:~# man manMAN(1P) POSIX Programmer's Manual(...)
Note how the prompt is different after the su -
command.
Also, if I run a ssh server inside the container and then connect to this container via ssh, then man is working perfectly.