/bin/sh: 1: sudo: not found when running dockerfile
Matthew Harrington
This is the content of my Dockerfile.
FROM ubuntu
RUN sudo apt-get update
RUN sudo apt-get install -y wget
CMD wget -O- -q When I run the Dockerfile to build a docker image, I get the below error:
/bin/sh: 1: sudo: not found
Can you please help me in solving the above error?
53 Answers
by default docker container runs as root user
remove the sudo from Dockerfile and run again.
Your commands in the Dockerfile already run as root during docker build. For this reason you do not need to use sudo
You don't need sudo in this case. Change Dockerfile as below -
FROM ubuntu
RUN apt-get update -y && \ apt-get install -y wget
CMD wget -O- -q PS - Merge the RUN statements as much as possible.
0