I am trying to build this Dockerfile for Go Application and then deploy this to GKE but I'm seen this error upon pod creation. Upon describing this pod, I observed the same error.:

Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./bin": stat ./bin: no such file or directory: unknown

This image successfully run locally using this command. docker run -it --rm bytecode01/domainalert:v2

#Dockerfile
FROM golang:alpine as builder
WORKDIR /data

COPY go.mod go.mod
RUN go mod download

# Copy the go source
COPY . .

# Build
RUN go build -a -o bin main.go

FROM alpine:latest

WORKDIR /data
COPY --from=builder /data/bin .
RUN chmod +x bin
CMD ["./bin"]

GKE PVC successfully mounted

#pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: de
  labels:
    name: de
spec:
  containers:
    - name: de-pod
      image: bytecode01/domainalert:v2
      imagePullPolicy: Always
      volumeMounts:
        - mountPath: /data
          name: app-volume
  volumes:
    - name: app-volume
      persistentVolumeClaim:
        claimName: pvc-dynamic
#pvc-dynamic.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-dynamic
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Mi
  storageClassName: standard

Help to get my issue solved.

0

There are 0 best solutions below