簡體   English   中英

錯誤回退在 nginx pod 中重新啟動失敗的容器

[英]error Back-off restarting failed container in nginx pod

使用 kubernetes 部署 nginx 映像的簡單用例

Dockerfile 用於創建圖像。 The "./build/" in the dockerfile COPY statement, is the output directory (npm run build) of reactjs code.Just static files in it.

FROM nginx
COPY ./build/ /usr/share/nginx/html/ 
RUN rm -f /etc/nginx/conf.d/default.conf
COPY ./default.conf /etc/nginx/conf.d/
CMD ["nginx"]
EXPOSE 80 

為什么 nginx 部署中會出現此錯誤? 錯誤是“后退重啟失敗的容器”。 手動運行容器,但 nginx 沒有運行。 我可以手動啟動 nginx。 我是否缺少 Dockerfile 或 /etc/nginx/conf.d/default.conf 文件中的任何配置? 文件被復制並在github路徑中可用以供參考。

root@desktop:~/github/nginx-app# docker run -it private.registry.corp/company-dev-poc/nginx-cms:001 bash
root@fc7ebd431ae2:/# service nginx status
[FAIL] nginx is not running ... failed!

使用CMD ["nginx", "-g", "daemon off;"]

此外,您不需要指定命令。 CMD 和 EXPOSE 將在基礎映像中定義 - 在這種情況下為 nginx。 它們不需要再次定義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM