[英]nginx.conf with bitnami nginx debian as base image for docker
I am trying to dockerize my angular app.我正在尝试对我的 angular 应用进行 docker 化。 When I go to the web page, everything works fine until I refresh the page (F5).
当我 go 到 web 页面时,一切正常,直到我刷新页面 (F5)。 When I used nginx:1.17.1-alpine as the base image, I fixed the problem by using the following nginx.conf file instead of the nginx.conf default file:
当我使用 nginx:1.17.1-alpine 作为基础镜像时,我通过使用以下 nginx.conf 文件而不是 nginx.conf 默认文件解决了这个问题:
server {
listen 4200;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}}
My dockerfile looked like that:我的 dockerfile 看起来像这样:
FROM nginx:1.17.1-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY /dist/frontend /usr/share/nginx/html
EXPOSE 4200
However now I need to use bitnami/nginx:1.21.6-debian-10-r88 as my base image.但是现在我需要使用 bitnami/nginx:1.21.6-debian-10-r88 作为我的基础镜像。 When I try to build the container, I get the following error:
当我尝试构建容器时,出现以下错误:
RUN rm /etc/nginx/conf.d/default.conf:
#15 0.399 rm: cannot remove '/etc/nginx/conf.d/default.conf': No such
file or directory
Anyone can help me figure out how to build the container properly?谁能帮我弄清楚如何正确构建容器?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.