Skip to content

Commit

Permalink
fix: create nonroot user in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Sep 29, 2020
1 parent 17cfa19 commit 3955a1b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ spec:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /csi
name: socket-dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- mountPath: /csi
name: socket-dir
Expand Down
2 changes: 2 additions & 0 deletions deploy/csi-azuredisk-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ spec:
optional: true
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /csi
name: socket-dir
Expand Down
1 change: 1 addition & 0 deletions deploy/csi-azuredisk-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ spec:
fieldPath: spec.nodeName
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- mountPath: /csi
name: socket-dir
Expand Down
4 changes: 4 additions & 0 deletions pkg/azurediskplugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ RUN clean-install util-linux e2fsprogs mount ca-certificates udev xfsprogs
LABEL maintainers="andyzhangx"
LABEL description="Azure Disk CSI Driver"

# Create a nonroot user
RUN useradd -u 10001 nonroot
USER nonroot

ENTRYPOINT ["/azurediskplugin"]
4 changes: 4 additions & 0 deletions pkg/azurediskplugin/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ RUN apt-get update && apt-get install -y util-linux e2fsprogs mount ca-certifica
LABEL maintainers="andyzhangx"
LABEL description="Azure Disk CSI Driver"

# Create a nonroot user
RUN useradd -u 10001 nonroot
USER nonroot

COPY ./_output/azurediskplugin /azurediskplugin
ENTRYPOINT ["/azurediskplugin"]

0 comments on commit 3955a1b

Please sign in to comment.