简体   繁体   中英

Docker ubuntu image - bash: man: command not found

Am getting started with Docker and just pulled up a basic ubuntu image. I am on a windows 7 box running Docker via docker-machine.

Do not know why, I am not able to find the man command on bash. I tried exporting the path of man to $PATH but still no joy.

docker@default:~$ docker run -it ubuntu bash
root@2dd12b770666:/# man ls
bash: man: command not found
root@2dd12b770666:/# whereis man
man: /usr/local/man /usr/share/man
root@2dd12b770666:/# export PATH=/usr/local/man:/usr/share/man:$PATH
root@2dd12b770666:/# echo $PATH
/usr/local/man:/usr/share/man:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@2dd12b770666:/# man
bash: man: command not found
root@2dd12b770666:/#

If export command does not work, not sure if editing bashrc would have any effect. So did not try that yet. Is there anything else I need to do to be able to run man on the docker image?

Note: for a completely fresh docker install, you may need:

apt-get update
apt-get install man

(I did: apt-get install man and got E: Unable to locate package man at first)

您必须在容器中安装man命令:

apt-get install man

Just install "man" inside container can solve your problem:

root@d16e09720264:/# apt-get install -y man

It seems that "man" should be already installed in container because you can find "man" by running whereis command:

root@d16e09720264:/# whereis man
man: /usr/local/man /usr/share/man

However, you can find the result of whereis has changed after intalling "man":

root@d16e09720264:/# whereis man
man: /usr/bin/man /usr/local/man /usr/share/man /usr/share/man/man1/man.1.gz

This indicates that "man" is not installed inside container by default. At least, "man" is not properly installed.

As far as I know, "vim" shows similar result.

$ sudo apt-get update

$ sudo apt-get install -y man

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM