我正在使用在 Docker 中启用了 WSL 的 Windows Home OS。
打印下面的构建消息后
docker build .
SECURITY WARNING: You are building a Docker image from Windows against a non- Windows Docker host. All files and directories added to build context will have '-rwxr- xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
当我尝试运行下面的图像消息时打印
docker run 49fee6f5a6bb -d
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"-d\": executable file not found in $PATH": unknown.
Dockerfile 内容如下
FROM golang:alpine
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Move to working directory /build
WORKDIR /build
# Copy and download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY . .
# Build the application
RUN go build -o main .
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/main .
# Export necessary port
EXPOSE 3000
# Command to run when starting the container
CMD ["/dist/main"]
LEATH
相关分类