Skip to content

Commit 23b086d

Browse files
authored
Fix(image): use fixed user id instead of username (#6413)
1 parent 57511e4 commit 23b086d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

charts/tidb-operator/values.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ operator:
4848

4949
# SecurityContext is security config of this component, it will set template.spec.securityContext
5050
# Refer to https://kubernetes.io/docs/tasks/configure-pod-container/security-context
51-
securityContext: {}
52-
# runAsUser: 1000
53-
# runAsGroup: 2000
51+
securityContext:
52+
runAsNonRoot: true
53+
runAsUser: 1000
54+
runAsGroup: 2000
5455
# fsGroup: 2000
5556

5657
# PodAnnotations will set template.metadata.annotations

image/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ FROM --platform=$TARGETPLATFORM ghcr.io/pingcap-qe/bases/pingcap-base:v1.10.0@sh
2929

3030
ARG TARGETPLATFORM
3131

32-
USER pingcap:pingcap
32+
# Use numeric UID:GID instead of username for Kubernetes compatibility.
33+
# Base image defines: PINGCAP_UID=1000, PINGCAP_GID=2000 (pingcap:pingcap)
34+
# Kubernetes runAsNonRoot requires numeric user to verify non-root execution.
35+
# Reference: https://github.com/PingCAP-QE/artifacts/blob/main/dockerfiles/bases/pingcap-base/Dockerfile
36+
USER 1000:2000
3337

3438
WORKDIR /
3539

@@ -41,7 +45,7 @@ FROM --platform=$TARGETPLATFORM ghcr.io/pingcap-qe/bases/pingcap-base:v1.10.0@sh
4145

4246
ARG TARGETPLATFORM
4347

44-
USER pingcap:pingcap
48+
USER 1000:2000
4549

4650
WORKDIR /
4751

@@ -53,7 +57,7 @@ FROM --platform=$TARGETPLATFORM ghcr.io/pingcap-qe/bases/pingcap-base:v1.10.0@sh
5357

5458
ARG TARGETPLATFORM
5559

56-
USER pingcap:pingcap
60+
USER 1000:2000
5761

5862
WORKDIR /
5963

@@ -67,7 +71,7 @@ FROM --platform=$TARGETPLATFORM ghcr.io/pingcap-qe/bases/pingcap-base:v1.10.0@sh
6771

6872
ARG TARGETPLATFORM
6973

70-
USER pingcap:pingcap
74+
USER 1000:2000
7175

7276
WORKDIR /
7377

0 commit comments

Comments
 (0)