LoginSignup
7
9

More than 5 years have passed since last update.

コンテナ内でmanを読みたい

Posted at

やりたいこと

コンテナ内にシェルでログインして作業しているときに、manコマンドでマニュアルを読みたい。
例えば、docker run -it --rm centos:7 bash のような感じでちょっとした作業をしたくてコンテナを作る場合を想定。
そもそも man コマンドが入っていない。 man コマンドをインストールしてもエントリーがないと言われる。

# man bash
bash: man: command not found
# yum install -y man
# man bash
No manual entry for bash

原因

パッケージマネージャーがmanのエントリーを導入しない設定になっているため。tsflags=nodocsの部分が該当の設定。

# 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.utf8
tsflags=nodocs
# 以下略

解決方法

CentOSの場合

# yum install -y man; yum reinstall --setopt=tsflags='' -y bash

Ubuntuの場合

# rm /etc/dpkg/dpkg.cfg.d/excludes; apt-get update; apt-get install -y man; apt-get install -y --reinstall bash
7
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9