Docker Community Forums

Share and learn in the Docker community.

Question about distroless images of postgres

Hi I’d like to create distroless image of Postgres, here the code from Dockerfile:

### First Stage ###
# Base Image
FROM postgres:13-alpine as build
WORKDIR /usr/src/app/postgres

### Second Stage ###
FROM gcr.io/distroless/base-debian10
COPY --from=build /usr/src/app/postgres /usr/src/app/postgres
WORKDIR /usr/src/app/postgres

# Change user to non-root
USER 1002

# Run POSTGRES
CMD ["/postgres"]

after succesfully build the Dockerfile, there’s 4 of final images

I’m quite new to docker and from my understanding one Dockerfile should result in 1 image and not 4, is anyone can help me why there’s 4 images instead of 1?