复制自定义配置后Nginx Docker容器卡在启动就绪状态求助
Docker容器运行异常排查求助
问题背景
我尝试运行一个Docker容器,当Dockerfile中包含复制自定义Nginx配置的语句时,容器无法正常启动;但移除该语句后,容器可以正常运行。我已经确认Nginx配置文件语法检测通过,且尝试使用默认配置也存在问题,因此怀疑问题不在配置文件本身,求排查线索。
原Dockerfile(无法正常运行)
FROM node:14-alpine AS builder WORKDIR '/app' COPY package.json . RUN npm install COPY . . RUN npm run build FROM nginxinc/nginx-unprivileged COPY --from=builder /app/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/
修改后的Dockerfile(可正常运行)
FROM node:14-alpine AS builder WORKDIR '/app' COPY package.json . RUN npm install COPY . . RUN npm run build FROM nginxinc/nginx-unprivileged COPY --from=builder /app/build /usr/share/nginx/html
我的Nginx配置文件
pid /tmp/nginx.pid; events {} http { server { location /api { proxy_set_header Host $host; proxy_set_header Cookie $http_cookie; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_pass http://#removed_for_privacy#; } location /socket.io/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_pass #removed_for_privacy#; } location / { index index.html; try_files $uri $uri/ /index.html; } } }
Nginx配置语法检测结果
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
请问对此有什么排查线索吗?
内容的提问来源于stack exchange,提问作者jvdutrag
相关产品推荐
相关产品推荐

