我正在尝试使用此Dockerfile构建一个最小的docker镜像
FROM debian:stretch-slim AS builder
ENV VERSION 1.9.3.
ENV OS linux
ENV ARCH amd64
RUN apt update && apt upgrade -y && apt install -y curl
RUN curl -O -fsSL "https://dl.google.com/go/go$VERSION$OS-$ARCH.tar.gz" \
&& tar -C /usr/local -xzf "go$VERSION$OS-$ARCH.tar.gz"
RUN /usr/local/go/bin/go env
FROM scratch
ENV GOPATH=/code
ENV PATH=/usr/local/go/bin
COPY --from=builder /usr/local/go /usr/local/go
CMD ["/usr/local/go/bin/go"]
使用docker build -t golang:1.9.3 .
构建此图片。如果像docker run --rm -ti golang:1.9.3
这样执行
standard_init_linux.go:195: exec user process caused "no such file or directory"
修改: 我知道像golang这样的码头集线器上的golang图像:alpine,大小约为265MB。