News for hackers. Stuff that matters.
Re:Intro Guide to Dockerfile Best Practices by itamarst on Monday July 08, 2019 @08:49AM (#20382254)
Yes!

To be fair the official documentation Dockerfile best practices does mention this (although it also gives contradictory advice).

Re:Intro Guide to Dockerfile Best Practices by cmdkeen on Monday July 08, 2019 @10:19AM (#20382908)
The documentation may do but many of the official images run as root and provide little to no documentation on how to change that, the Bitnami images in comparison are light years ahead.
Re:Intro Guide to Dockerfile Best Practices by atmosx on Tuesday July 09, 2019 @01:11AM (#20389171)
A simple multistage example for Golang apps would be:

  FROM golang:1.12.4
  WORKDIR /opt/src/github.com/project1/myprog/
  COPY . .
  RUN go get -d -v ./...
  RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=vendor -o myprog .
  
  FROM ubuntu:latest
  RUN useradd -u 5002 user1
  
  FROM scratch
  COPY --from=0 /opt/src/github.com/project1/myprog/myprog .
  COPY --from=1 /etc/passwd /etc/passwd
  USER user1
  ENTRYPOINT ["./myprog"]
Re:Intro Guide to Dockerfile Best Practices by cmdkeen on Tuesday July 09, 2019 @05:45AM (#20390227)
Indeed - and there's no mention of any of this at https://hub.docker.com/_/golang - compare with https://hub.docker.com/r/bitnami/nginx that discussed non-root users and how to use it.