好物优选点击查看详情 京东购买

暂无内容

【故障排查】k8s/docker容器启动后报错 nginx: [emerg] unexpected end of parameter, expecting “;“ in command line

报错信息:

 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 

在这里插入图片描述

处理方法:

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://blog.csdn.net/Nightwish5/article/details/130221768?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994567316782425116482%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994567316782425116482&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-29-130221768-null-null.268%5Ev1%5Ekoosearch&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享