Error while trying to run an image - Docker

0 votes

I build an image, which was successful. But when i try to run it using the command 

sudo docker run -p 80:80 imagename

I got the following error

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \" /usr/sbin/apache2\": stat  /usr/sbin/apache2: no such file or directory": unknown.
ERRO[0001] error waiting for container: context canceled

I couldn't find and answer anywhere, thank you in advance.

Aug 22, 2018 in Docker by lina
• 8,220 points
12,433 views

1 answer to this question.

0 votes
This error means that the container tries to start a program that is in  /usr/sbin/apache2\ but is not able to find a file or directory with that particular name. Can you please edit your answer and add your dockerfile?
answered Aug 22, 2018 by Nilesh
• 7,060 points
FROM ubuntu:12.04

RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf /var/lib/apt/lists/*

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2

EXPOSE 80

CMD [" /usr/sbin/apache2", "-D", "FOREGROUND"]
Remove the space in your CMD[" /usr/sbin/apache2", "-D", "FOREGROUND"]
make it CMD["usr/sbin/apache2","-D", "FOREGROUND"]
and build and run it again
Thanks @Nilesh, that space was the issue. It worked perfectly fine after removing it.

Related Questions In Docker

0 votes
1 answer

How to run an image with volume on docker for windows?

Try : declaring the volume of container mounting the ...READ MORE

answered Sep 20, 2018 in Docker by Tyrion anex
• 8,700 points
903 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,747 views
0 votes
1 answer

docker swarm throwing an error “swarm already part of swarm”

You run the docker swarm init to create ...READ MORE

answered Aug 22, 2018 in Docker by Nilesh
• 7,060 points
4,377 views
0 votes
1 answer

Init could not choose ip address error while doing docker swarm init

First look for the public IP of ...READ MORE

answered Aug 23, 2018 in Docker by Nilesh
• 7,060 points
3,552 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP