Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Build Error : The command '/bin/sh -c apt-get install –y apache2' returned a non-zero code: 100

I am trying to build a Dockerfile

FROM ubuntu 
RUN apt-get update 
RUN apt-get install –y apache2 
RUN apt-get install –y apache2-utils 
RUN apt-get clean 
EXPOSE 80
CMD [“apache2ctl”, “-D”, “FOREGROUND”]

when i am running this command docker build –t=”mywebserver” . I am getting below provided error in console

E: Unable to locate package –y
The command '/bin/sh -c apt-get install –y apache2' returned a non-zero code: 100
like image 827
Sritam Jagadev Avatar asked Oct 21 '25 06:10

Sritam Jagadev


2 Answers

I'm not sure how, but I think you're using an en dash instead of a hyphen in front of your y.

You want -y rather than –y

If you look closely there's a subtle difference.

like image 144
Abulafia Avatar answered Oct 22 '25 20:10

Abulafia


The Dockerfile looks fine so could be something to do with a proxy/firewall.

I would try the following:

FROM ubuntu 
RUN apt-get update

Run with docker build --no-cache -t mywebserver and see if it performs the update without issues. If not then I would suggest looking at setting http/https proxy with ENV inside the dockerfile.

like image 40
Nordle Avatar answered Oct 22 '25 21:10

Nordle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!