1

我有一个 golang 应用程序,我创建了 dockerfile,它可以进行多权益构建。app_1 | standard_init_linux.go:211: exec user process caused "exec format error" 但是每次尝试做时我都会遇到这个错误docker-compose up。Dockerfile:


# Start from the latest golang base image
FROM golang:1.13 as builder

# Set the Current Working Directory inside the container
WORKDIR /memesbot

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

# Copy the source from the current directory to the Working Directory inside the container
COPY . .

# Build the Go app
RUN go build -o /memesbot/cmd/main .

######## Start a new stage from scratch #######
FROM alpine:latest


RUN apk --no-cache add ca-certificates

WORKDIR /root/

# Copy the Pre-built binary file from the previous stage
COPY --from=builder /memesbot/cmd/main .

RUN chmod +x ./main

# Command to run the executable
CMD ["./main"]

和码头工人组成:

version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "7777:7777"
    environment:
      TELEGRAM_TOKEN: xxxx

我该如何解决这个错误?

4

0 回答 0