gpt4 book ai didi

docker - 运行docker image Standard_init_linux.go:211时出错:exec用户进程导致“没有这样的文件或目录”

转载 作者:行者123 更新时间:2023-12-01 22:25:58 26 4
gpt4 key购买 nike

我尝试构建一个用于我的kubernetes部署的docker映像。但是泊坞窗映像返回错误。
这是我的dockerfile的内容:

    FROM golang:latest as builder
# Add Maintainer Info
LABEL maintainer="me <me@ex.com>"
# Set the Current Working Directory inside the container
WORKDIR /kube
# 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 CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o kube .
######## 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 /kube .
# Expose port 8080 to the outside world
EXPOSE 8080
# Command to run the executable
CMD ["./kube"]****

当在ubuntu 18.04终端中运行docker run name:tag时,它给了我:
standard_init_linux.go:211:exec用户进程导致“没有这样的文件或目录”

编辑:部门。项目树:
go-proje
|
|go.mod
|go.sum
|
|----ci
|
|
-----kube
|
|Dockerfile
|kube

并生成命令:
sudo docker build -t名称:tag -f ci / kube / Dockerfile --network host。

最佳答案

对于初学者删除

#!/bin/sh

从您的Dockerfile

关于docker - 运行docker image Standard_init_linux.go:211时出错:exec用户进程导致“没有这样的文件或目录”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59966365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com