无法在 openshift 中创建文件给出权限被拒绝
not able to create a file in openshift gives Permission denied
我有以下 docker 文件并使用我创建了 docker 图像,该图像用于我的 openshift 部署,但 pod 的日志显示错误
/bin/sh: can't create /etc/nginx/conf.d/default.conf: Permission denied
这是我的 Dockerfile
FROM abc/abc-ui-base:latest AS build
FROM nginx:stable-alpine
RUN set -ex && apk --update add ruby
COPY --from=build /root/build/nginx.docker.conf /etc/nginx/conf.d/fs.template
COPY --from=build /root/dist /public
RUN chmod go+w /var/cache/nginx
RUN chmod -R 777 /etc/nginx
CMD erb /etc/nginx/conf.d/fs.template > /etc/nginx/conf.d/default.conf; cat /etc/nginx/conf.d/default.conf; nginx -g 'daemon off;'
我在 docker 文件中添加了以下行,问题已解决。所以 erb 命令起作用了
RUN chmod 777 /etc/nginx/conf.d/default.conf
我有以下 docker 文件并使用我创建了 docker 图像,该图像用于我的 openshift 部署,但 pod 的日志显示错误
/bin/sh: can't create /etc/nginx/conf.d/default.conf: Permission denied
这是我的 Dockerfile
FROM abc/abc-ui-base:latest AS build
FROM nginx:stable-alpine
RUN set -ex && apk --update add ruby
COPY --from=build /root/build/nginx.docker.conf /etc/nginx/conf.d/fs.template
COPY --from=build /root/dist /public
RUN chmod go+w /var/cache/nginx
RUN chmod -R 777 /etc/nginx
CMD erb /etc/nginx/conf.d/fs.template > /etc/nginx/conf.d/default.conf; cat /etc/nginx/conf.d/default.conf; nginx -g 'daemon off;'
我在 docker 文件中添加了以下行,问题已解决。所以 erb 命令起作用了
RUN chmod 777 /etc/nginx/conf.d/default.conf