あまり需要は無いかもしれませんが、Centos7公式Dockerコンテナにmanを入れてみます。
コンテナ起動してシェル
λ docker run -itd --name centos7 centos:7 8f6cc6082a48ba4519672840fec82254912c97d57490513c65c65366e6292165 λ docker exec -it centos7 /bin/bash
早速man
# man bash: man: command not found
man自体入ってないようです
インストール
# yum -y install man-pages
早速確認
# man cp No manual entry for cp
あれっ(´・ω・`)・・・
ドキュメントが有るか確認
# manpath /usr/local/share/man:/usr/share/man
# ls /usr/local/share/man man1 man1x man2 man2x man3 man3x man4 man4x man5 man5x man6 man6x man7 man7x man8 man8x man9 man9x mann # ls /usr/share/man man0p man1 man1p man1x man2 man2x man3 man3p man3x man4 man4x man5 man5x man6 man6x man7 man7x man8 man8x man9 man9x mann # ls /usr/local/share/man/man1 # ls /usr/local/share/man/man1
何もナ━(゚Д゚)━イ!!
yum.conf確認
想定外の動きをするときはとりあえず/etc下の設定ファイル見ます
# cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release override_install_langs=en_US.UTF-8 tsflags=nodocs # This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
yum.confにtsflags=nodocs
の記述がありました。こちらは「ドキュメント類をインストールしない」設定となります。
コンテナイメージですから極力余分なものはインストールしない設定となっているようです。合理的。
再度インストール
# yum --setopt=tsflags='' reinstall man-pages
DockerfileにRUNコマンドを書く際には
RUN yum -y --setopt=tsflags='' install man-pages
などと記載するといいかもしれません。
確認
# man cp CP(1P) POSIX Programmer's Manual CP(1P) PROLOG This manual page is part of the POSIX Programmer's Manual. The Linux imple- mentation of this interface may differ (consult the corresponding Linux man- ual page for details of Linux behavior), or the interface may not be imple- mented on Linux. NAME cp - copy files SYNOPSIS cp [-fip] source_file target_file cp [-fip] source_file ... target cp -R [-H | -L | -P][-fip] source_file ... target cp -r [-H | -L | -P][-fip] source_file ... target . . .
ε-(´∀`*)ホッ