Skip to content

Commit 4392975

Browse files
committed
fix(registry): set gid uid to 1001
1 parent d18b7b5 commit 4392975

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

Dockerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ RUN export GO111MODULE=on \
99

1010
FROM docker.io/drycc/base:bullseye
1111

12-
RUN adduser --system \
13-
--shell /bin/bash \
14-
--disabled-password \
15-
--home /var/lib/registry \
16-
--group \
17-
drycc
12+
ARG DRYCC_UID=1001
13+
ARG DRYCC_GID=1001
14+
ARG DRYCC_HOME_DIR=/var/lib/registry
15+
16+
RUN groupadd drycc --gid ${DRYCC_GID} \
17+
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}
1818

1919
COPY rootfs/bin/ /bin/
2020
COPY rootfs/config-example.yml /etc/docker/registry/config.yml
21-
COPY --from=build /usr/local/bin/registry /opt/registry/sbin/registry
21+
COPY --from=build /usr/local/bin/registry /opt/registry/bin/registry
2222
ENV JQ_VERSION="1.6" \
2323
MC_VERSION="2022.02.26.03.58.31" \
2424
REGISTRY_VERSION="2.8.0"
@@ -41,9 +41,9 @@ RUN install-stack jq $JQ_VERSION \
4141
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
4242
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
4343
&& mkdir -p /usr/share/man/man{1..8} \
44-
&& chown -R drycc:drycc /var/lib/registry
44+
&& chown -R drycc:drycc ${DRYCC_HOME_DIR}
4545

4646
USER drycc
47-
VOLUME ["/var/lib/registry"]
48-
CMD ["/opt/registry/sbin/registry"]
47+
VOLUME ["${DRYCC_HOME_DIR}"]
48+
CMD ["/opt/registry/bin/registry"]
4949
EXPOSE 5000

charts/registry/templates/registry-deployment.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
- name: drycc-registry-init
2828
image: docker.io/drycc/python-dev:latest
2929
imagePullPolicy: {{.Values.imagePullPolicy}}
30-
command:
30+
args:
3131
- netcat
3232
- -v
3333
- -a
@@ -70,6 +70,10 @@ spec:
7070
mountPath: /var/lib/registry
7171
- name: objectstorage-creds
7272
mountPath: /var/run/secrets/drycc/objectstore/creds
73+
securityContext:
74+
fsGroup: 1001
75+
runAsGroup: 1001
76+
runAsUser: 1001
7377
volumes:
7478
- name: registry-storage
7579
emptyDir: {}

0 commit comments

Comments
 (0)