[英]how to make non root user as sudo user in docker alpine image?
[英]How to handle make missing from alpine docker image?
我的應用程序上有 Makefile,所有命令都在 Makefile 上,我把它放在 Dockerfile 上:
# start from the latest golang base image
FROM golang:alpine
RUN apk update && apk add --no-cache gcc && apk add --no-cache libc-dev
# Set the current working Directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. they will be cached of the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source from the current directory to the WORKDIR inisde the container
COPY . .
# Build the Go app
RUN go build .
# Exporse port 3000 or 8000 to the outisde world
EXPOSE 3000
# Command to run the executable
CMD ["make", "-C", "scripts", "test" ]
CMD ["make", "-C", "scripts", "prod" ]
並得到
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:349: starting container process caused "exec:
\"make\": executable file not found in $PATH": unknown.
是否可以在 Docker 中運行make -c scripts test
? 如何更正在 Docker 中使用此命令的方法?
在dockerfile
我運行golang:alpine
如果您希望避免將 make 的所有依賴項添加到您的 alpine 映像中並保持運輸容器的尺寸較小:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.