In docker can't use tree command, get error: /bin/sh: 52: tree: not found

215 Views Asked by At

I'm using docker, I want to use tree command, but I get error:

# tree -L 1
/bin/sh: 52: tree: not found
# whereis tree
tree:
# apt install tree
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package tree
# pip install tree
Requirement already satisfied: tree in /usr/local/lib/python3.8/site-packages (0.2.4)
Requirement already satisfied: Pillow in /usr/local/lib/python3.8/site-packages (from tree) (10.0.1)
Requirement already satisfied: svgwrite in /usr/local/lib/python3.8/site-packages (from tree) (1.4.3)
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (from tree) (57.0.0)
Requirement already satisfied: click in /usr/local/lib/python3.8/site-packages (from tree) (8.1.7)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
# tree -L 1
/bin/sh: 56: tree: not found
# 

How should I do?

1

There are 1 best solutions below

0
Tom On

According to solution that @Klaus D. give.

First run command:

apt update

then run command:

apt install tree

now can use tree -L 1 command.