在kubernetes中部署前端项目(使用nginx作为服务器)的时候,遇到了一个报错,报错信息如下
2019/11/19 02:16:31 [emerg] 1#1: open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14
nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14
提示的意思是没有找到mine.types文件,也就是说容器内/etc/nginx下不存在这个文件。但是这个文件不是nginx提供的吗?
我赶忙看了下我是如何部署这个容器的。
dockerfile:
FROMnginx:1.17.3COPY dist /usr/share/nginx/html
deployment.yml:
apiVersion:apps/v1beta2kind:Deploymentmetadata:name:smcp-webnamespace:nginx-testspec:selector:matchLabels:app:smcp-webreplicas:1template:metadata:labels:app:smcp-webspec:containers:- name:smcp-webimage:docker-registry.xxx.com/fe/fe-nginx:no-nginx-confports:- containerPort:80volumeMounts:- name:nginx-confmountPath:/etc/nginxvolumes:- name:nginx-confconfigMap:name:nginx-confitems:- key:nginx.confpath:nginx.conf