21
votes

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?

4

4 Answers

25
votes

You have to install man command in the container:

apt-get install man
21
votes

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)

2
votes

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.

2
votes
$ sudo apt-get update

$ sudo apt-get install -y man