报错信息:
kubectl apply -f 05-wp-dp.yaml
[root@master01 wordpressDemo]
nginx: [emerg] unexpected end of parameter, expecting ";" in command line
docker run -itd harbor.oldxu.net/base/wordpress:v6.0
[root@node4 wordpress]
nginx: [emerg] unexpected end of parameter, expecting ";" in command line
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/6431f34bb37683423056426f1f337661.png)
处理方法:
entrypoint.sh的nginx启动方式nginx -g "daemon off", 少写了 ; 号 ,将;号补上,重新docker build 即可
[root@node4 wordpress]
Dockerfile index.php readme.html wp-admin wp-comments-post.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
entrypoint.sh license.txt wp-activate.php wp-blog-header.php wp-config.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php
[root@node4 wordpress]
Wordpress_File=/usr/share/nginx/html/wp-config.php
php-fpm && \
nginx -g "daemon off"
其他 & 排查过程 & 反思
Dockerfile的内容没错,entrypoint.sh文件有问题。
nginx: [emerg] unexpected end of parameter, expecting ";" in command line
没真正理解这个报错含义。开始以为是配置文件少;号。 实际的定语 in command line ,期待;号。 (英文理解有待提升)
nginx -g "daemon off" --改成--> nginx -g "daemon off;"
单独部署nginx服务,使用nginx -t 检查blog.oldxu.net.conf的语法是OK的。将其configmap化,dp调用他。 或者dp中注释它还是报这错。
然后dp换了oldxu的镜像(oldxu3957/wordpress:v6.0),能正常运行,也说明cm是没问题的。 而问题所在是dockerfile构建出来的镜像运行有问题。
实际上conf文件少;号的报错信息如下:
[root@node-2 conf.d]
nginx: [emerg] invalid parameter "server_name" in /etc/nginx/conf.d/blog.oldxu.net.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@node-2 conf.d]
[root@node-2 conf.d]
nginx: [emerg] invalid number of arguments in "fastcgi_param" directive in /etc/nginx/conf.d/blog.oldxu.net.conf:13
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@node-2 conf.d]
[root@node-2 conf.d]
[root@node-2 conf.d]
nginx: [emerg] unexpected end of file, expecting "}" in /etc/nginx/conf.d/blog.oldxu.net.conf:16
nginx: configuration file /etc/nginx/nginx.conf test failed
反思
粗心了,漏写 抄错。。。
百度和gpt搜出来的东西,作为参考思路吧。
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/f5bc2583d77e326d6776adb798613b06.png)