Docker 启动异常 不显示报错信息

错误的启动配置

sudo docker run --rm  -d \
-p 80:80 -p 443:443 nginx

执行结果为返回容器 id , 但容器未启动, 无报错信息

sudo docker run --rm  -itd \
-p 80:80 -p 443:443 nginx bash

执行结果为容器启动并在后台挂起, 但 nginx 未启动成功, 无报错信息

sudo docker run --rm  -it \
-p 80:80 -p 443:443 nginx bash

执行结果为进入容器的 bash 界面, 但 nginx 未启动, 无报错信息

合理的启动配置

sudo docker run --rm  -it \
-p 80:80 -p 443:443 nginx

不启用 bash , 可看到报错信息

/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: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/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
nginx: [emerg] duplicate location "/" in /etc/nginx/nginx.conf:34

posted @ 2023-04-23 12:08  Boiiea  阅读(1135)  评论(0)    收藏  举报