Skip to content

Commit 36ddba4

Browse files
authored
Merge pull request #252 from andyzhangx/nonroot
fix: create nonroot user in Dockerfile
2 parents e2bbbe1 + 4332a49 commit 36ddba4

File tree

6 files changed

+14
-0
lines changed

6 files changed

+14
-0
lines changed

charts/latest/blob-csi-driver/templates/csi-blob-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ spec:
9696
- name: CSI_ENDPOINT
9797
value: unix:///csi/csi.sock
9898
imagePullPolicy: {{ .Values.image.blob.pullPolicy }}
99+
securityContext:
100+
runAsUser: 0
99101
volumeMounts:
100102
- mountPath: /csi
101103
name: socket-dir

charts/latest/blob-csi-driver/templates/csi-blob-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ spec:
106106
imagePullPolicy: {{ .Values.image.pullPolicy }}
107107
securityContext:
108108
privileged: true
109+
runAsUser: 0
109110
volumeMounts:
110111
- mountPath: /csi
111112
name: socket-dir

deploy/csi-blob-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec:
9393
optional: true
9494
- name: CSI_ENDPOINT
9595
value: unix:///csi/csi.sock
96+
securityContext:
97+
runAsUser: 0
9698
volumeMounts:
9799
- mountPath: /csi
98100
name: socket-dir

deploy/csi-blob-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ spec:
104104
fieldPath: spec.nodeName
105105
securityContext:
106106
privileged: true
107+
runAsUser: 0
107108
volumeMounts:
108109
- mountPath: /csi
109110
name: socket-dir

pkg/blobplugin/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ RUN apt update && apt install nfs-common nfs-kernel-server -y || true
3030
LABEL maintainers="andyzhangx"
3131
LABEL description="Azure Blob Storage CSI driver"
3232

33+
# Create a nonroot user
34+
RUN useradd -u 10001 nonroot
35+
USER nonroot
36+
3337
ENTRYPOINT ["/blobplugin"]

pkg/blobplugin/dev.Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ RUN dpkg -i /tmp/packages-microsoft-prod.deb && apt-get update && apt-get instal
1818
LABEL maintainers="andyzhangx"
1919
LABEL description="Azure Blob Storage CSI driver"
2020

21+
# Create a nonroot user
22+
RUN useradd -u 10001 nonroot
23+
USER nonroot
24+
2125
COPY ./_output/blobplugin /blobplugin
2226
ENTRYPOINT ["/blobplugin"]

0 commit comments

Comments
 (0)