Unable to use sudo commands within Docker, "bash: sudo: command not found" is displayed
Andrew Mclaughlin
I have installed TensorFlow using the following command
docker run -it and I need to set up TensorFlow Serving on a windows machine. I followed the instructions and while running the below-mentioned sudo command while installing TensorFlow Serving dependencies:
sudo apt-get update && sudo apt-get install -y \ build-essential \ curl \ git \ libfreetype6-dev \ libpng12-dev \ libzmq3-dev \ pkg-config \ python-dev \ python-numpy \ python-pip \ software-properties-common \ swig \ zip \ zlib1g-devThe following error is displayed:
bash: sudo: command not found 1 2 Answers
docker comes along with root it doesnt require sudo.
BTW if you want sudo in docker if you want to install sudo,
try this,
apt-get update && \ apt-get -y install sudonow you can use sudo along with your command in docker...
8Docker images typically do not have sudo, you are already running as root by default. Try
apt-get update && apt-get install -y build-essential curl git libfreetype6-dev libpng12-dev libzmq3-dev pkg-config python-dev python-numpy python-pip software-properties-common swig zip zlib1g-dIf you wish to not run as root, see the Docker documentation on the User command.
11