【排错】docker run启动容器加-v后自动关闭
2022年10月19日 05:44:19 作者:Jiaozn 分类:Docker 评论(0)docker启动一个nginx容器,加-V启动不起来,不加就可以正常启动。
排除了内存问题(内存够用),然后查看日志
docker logs ID
$ sudo docker logs cda
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/10/20 08:38:38 [emerg] 1#1: unexpected "}" in /etc/nginx/conf.d/default.conf:15
nginx: [emerg] unexpected "}" in /etc/nginx/conf.d/default.conf:15
原来是配置文件写错了,启动脚本是没有问题的。
编辑配置文件,发现nginx配置文件少了一个;号,nginx执行出错所以退出了容器
修改配置文件后,启动成功。
评论
发表评论