mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
docker: run geth as non-root user
Establish a dedicated 'geth' user and group to run the process. This follows the principle of least privilege and improves container isolation by avoiding root execution within the final image.
This commit is contained in:
parent
127d1f42bb
commit
33e1129aeb
1 changed files with 5 additions and 0 deletions
|
|
@ -20,8 +20,13 @@ RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
|
RUN addgroup -g 1000 geth && \
|
||||||
|
adduser -u 1000 -G geth -s /bin/sh -D geth
|
||||||
|
|
||||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||||
|
|
||||||
|
USER geth
|
||||||
|
|
||||||
EXPOSE 8545 8546 30303 30303/udp
|
EXPOSE 8545 8546 30303 30303/udp
|
||||||
ENTRYPOINT ["geth"]
|
ENTRYPOINT ["geth"]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue