dockerdockerfile

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

Solution

  • 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.