Docker Community Forums

Share and learn in the Docker community.

Why use multi-stage build get multi image

build

(Qksl) #1

Hey,Guys,I’m very new in Docker
I get a Problem
Dockerfile:
FROM dep-gin3:1.0
WORKDIR /go/src/gin3
COPY . .
RUN go install .

FROM alpine:latest
COPY --from=0 /go/bin /usr/local/bin
WORKDIR /app
CMD [“gin3”]

image list before build:
root@gsu:/go/src/gin3# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gin3_web latest f01ab68b6797 8 minutes ago 33.1MB
dep-gin3 1.0 2f4c7b6bc340 About an hour ago 427MB
mysql 5.7 75576f90a779 2 weeks ago 372MB
golang 1.10-alpine 34d3217973fd 4 weeks ago 394MB
alpine latest 11cd0b38bc3c 5 weeks ago 4.41MB

docker build -t test:0.1 .

Help me ,Why there get two image ,I’m going carzy
Thanks .Verrrrrrrry much