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,100 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 6,900 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_LOG_DIR /var/log/apache2


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 19, 2018 in Docker by Tyrion anex
• 8,280 points
0 votes
1 answer
0 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
• 56,140 points
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
• 6,900 points
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
• 6,900 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.