Home  >  Article  >  Backend Development  >  Docker Error: 'failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process' - How do I fix the 'permission denied' error?

Docker Error: 'failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process' - How do I fix the 'permission denied' error?

Susan Sarandon
Susan SarandonOriginal
2024-11-10 09:41:03823browse

Docker Error:

Docker Error: Failed to Create Shim Task

When trying to run a docker image, users may encounter the error message "docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process." This error indicates that Docker is encountering issues with starting the container process due to permission or configuration problems.

Addressing Permission Denials

In the specific case described in the question, the error message "exec: ./deployment-service: permission denied: unknown" suggests that the deployment-service executable lacks execution permissions within the container. To resolve this issue, add the folgenden instruction to the Dockerfile before the CMD command:

RUN chmod +x deployment-service

This line will grant execution permissions to the deployment-service file.

With the proper permission in place, the docker should be able to start the container process successfully. Here is an updated Dockerfile with the added RUN line:

FROM golang:1.19.2-alpine as builder

RUN apk add bash

RUN apk add --no-cache openssh-client ansible git

RUN mkdir /workspace
WORKDIR /workspace

COPY go.mod ./
COPY go.sum ./

RUN go mod download

COPY . ./

RUN go build -o deployment-service cmd/deployment-service/main.go

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/

COPY --from=builder /workspace .

ARG DEFAULT_PORT=8080
ENV PORT $DEFAULT_PORT

EXPOSE $PORT

RUN chmod +x deployment-service

CMD ["./deployment-service"]

Once the updated Dockerfile is applied, the docker run command should execute without the permission denied error.

The above is the detailed content of Docker Error: 'failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process' - How do I fix the 'permission denied' error?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn