서버/docker

[docker] docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/fortuneloop.sh": permission denied: unknown.

ttoance 2024. 10. 2. 06:43

 

이슈

 

fortuneloop.sh

#!/bin/bash
trap "exit" SIGINT

INTERVAL=$1
echo Configured to generate new fortune every $INTERVAL seconds

mkdir -p /var/htdocs

while :
do
  echo $(date) Writing fortune to /var/htdocs/index.html
  /usr/games/fortune > /var/htdocs/index.html
  sleep $INTERVAL
done

 

Dockerfile

FROM ubuntu:latest

RUN apt-get update ; apt-get -y install fortune
ADD fortuneloop.sh /bin/fortuneloop.sh

ENTRYPOINT ["/bin/fortuneloop.sh"]
CMD ["10"]

 

 

chmod로 주면 될거 같았는데 계속 파일을 못찾았다. 

 

 

이렇게 고치니까 해결되었다. 

FROM ubuntu:latest

RUN apt-get update ; apt-get -y install fortune
ADD fortuneloop.sh /bin/fortuneloop.sh
RUN chmod +x /bin/fortuneloop.sh

ENTRYPOINT ["/bin/fortuneloop.sh"]
CMD ["10"]

 

 

 

 

참고링크 

https://stackoverflow.com/questions/72695311/failure-starting-docker-container-failed-to-create-shim-task-oci-runtime-crea

 

Failure starting Docker container. "failed to create shim task: OCI runtime create failed: runc create failed"

I am new to Ubuntu and new to Docker. I am running a command that was given to me in an explanation of how to start the project. I want to start my Docker containers and they fail with an error. Some

stackoverflow.com

 

 

반응형