[英]How to get 'man' working in an Alpine Linux Docker container?
I can't get man
to work in an Alpine Linux Docker container.我无法让
man
在 Alpine Linux Docker 容器中工作。
Pull Alpine Linux and start a container.拉取 Alpine Linux 并启动一个容器。
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
.安装
man
和man-pages
。
apk add man man-pages
Install a package and its documentation.安装 package 及其文档。
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
.按照@EugenMayer 的建议添加
mdicml-apropos
,我可以获得curl --manual
来工作,但不能man curl
。 Unfortunately, gnupg --manual
doesn't work at all.不幸的是,
gnupg --manual
根本不起作用。 This behaviour is inconsistent and unexpected.此行为是不一致且意外的。
You need to add 你需要添加
apk add mdocml-apropos
and then for each package you need the man packages for 然后对于每个包,你需要man包
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. 这个的来源(加上那里缺少的mdocml-apropos)是https://wiki.alpinelinux.org/wiki/Alpine_Linux:FAQ#Why_don.27t_I_have_man_pages_or_where_is_the_.27man.27_command.3F但是很有趣,我无法让它工作我。
Also tried to export TERM=xterm
to see if thats in iteractivity
issue but it is not. 还尝试
export TERM=xterm
以查看iteractivity
问题是否存在,但事实并非如此。
Also tried makewhatis /usr/share/man
manually, but no sucess. 也尝试了
makewhatis /usr/share/man
手动,但没有成功。
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 所以有一个联机帮助页
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 然后它工作
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.我尝试了Alpine Linux v3.15 Docker 容器的解决方案并且它有效。
docker pull alpine:3.15
docker run --rm --name alpine -it alpine:3.15 /bin/sh
apk add curl
apk add curl-doc
typing man curl
, you will obtain the following error:输入
man curl
,您将收到以下错误:
/bin/sh: man: not found
In order to resolve the above error, type: apk add mandoc man-pages
为了解决上述错误,输入:
apk add mandoc man-pages
You should be able to view and browse the curl
's manual page!您应该能够查看和浏览
curl
的手册页!
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.如果您仍然遇到错误,请键入以下命令:
export PAGER=less
然后尝试再次查看curl
的手册页。
Additional resources:Install man
in an alpine linux docker container其他资源:在 alpine linux docker 容器中安装
man
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
. 我在LXD上使用alpine很多,当通过
lxc exec container ash
连接时通常无法读取任何手册页。 I suppose docker connect you to the container the same way. 我想docker会以同样的方式将你连接到容器。
$ lxc exec alp03 ash
~ # man man
more: -s: No such file or directory
So you can use su -
, and then you will be able to use man: 所以你可以使用
su -
,然后你就可以使用man:
~ # su -
alp03:~# man man
MAN(1P) POSIX Programmer's Manual
(...)
Note how the prompt is different after the su -
command. 注意
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. 此外,如果我在容器内运行一个ssh服务器,然后通过ssh连接到这个容器,那么man工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.