Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

/bin/sh: 1: sudo: not found when running dockerfile

Writer 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?

5

3 Answers

by default docker container runs as root user
remove the sudo from Dockerfile and run again.

enter image description here

2

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy