Skip to content

Commit dd751e3

Browse files
authored
fix: Fixed Dockerfiles to be able to run in Openshift without anyuid (#617)
1 parent 65f1ee6 commit dd751e3

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

debian/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/
5353

5454
RUN groupadd --system --gid 636 apisix \
5555
&& useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \
56-
&& chown -R apisix:apisix /usr/local/apisix
56+
&& chown -R apisix:0 /usr/local/apisix \
57+
&& chmod -R g=u /usr/local/apisix
5758

5859
USER apisix
5960

redhat/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ WORKDIR /usr/local/apisix
3535

3636
ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
3737

38+
RUN groupadd --system --gid 636 apisix \
39+
&& useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \
40+
&& chown -R apisix:0 /usr/local/apisix \
41+
&& chmod -R g=u /usr/local/apisix
42+
3843
# forward request and error logs to docker log collector
3944
RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
4045
&& ln -sf /dev/stderr /usr/local/apisix/logs/error.log \
4146
&& rm /usr/local/openresty/bin/etcdctl
4247

48+
USER apisix
49+
4350
EXPOSE 9080 9443
4451

4552
COPY ./docker-entrypoint.sh /docker-entrypoint.sh

ubuntu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/
5353

5454
RUN groupadd --system --gid 636 apisix \
5555
&& useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \
56-
&& chown -R apisix:apisix /usr/local/apisix
56+
&& chown -R apisix:0 /usr/local/apisix \
57+
&& chmod -R g=u /usr/local/apisix
5758

5859
USER apisix
5960

0 commit comments

Comments
 (0)