2233466866 / lnmp

Docker Linux+Nignx+MySQL+PHP+Node.js+Redis
https://hub.docker.com/r/2233466866/lnmp
MIT License
67 stars 34 forks source link

绑定下 /usr/local/nginx/ 就启动失败(容器存在,但是nginx未启动) #7

Closed hanrea closed 2 years ago

hanrea commented 3 years ago

正常 docker run -dit \ -p 8000:80 \ -v /data/www:/www \ --name=lnmp \ 2233466866/lnmp

添加 nginx配置绑定就失败

podman run -dit \ -p 8000:80 \ -v /data/www:/www \ -v /data/nginx/:/usr/local/nginx/ \ --name=lnmp \ 2233466866/lnmp

进容器,/usr/local/nginx/ 目录下只有conf目录,没有其他的, /data/nginx/ 目录权限777

docker logs 如下


Set hostname to <dcf8fa6d3aa1>.
Initializing machine ID from random generator.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Swap.
[  OK  ] Created slice Root Slice.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Journal Socket.
[  OK  ] Created slice System Slice.
         Starting Read and set NIS domainname from /etc/sysconfig/network...
[  OK  ] Reached target Slices.
         Starting Configure read-only root support...
[  OK  ] Started Read and set NIS domainname from /etc/sysconfig/network.
         Starting Journal Service...
[  OK  ] Started Configure read-only root support.
[  OK  ] Reached target Local File Systems.
         Starting Mark the need to relabel after reboot...
         Starting Create Volatile Files and Directories...
[  OK  ] Started Journal Service.
[  OK  ] Started Mark the need to relabel after reboot.
[  OK  ] Started Create Volatile Files and Directories.
[ INFO ] Update UTMP about System Boot/Shutdown is not active.
[DEPEND] Dependency failed for Update UTMP about System Runlevel Changes.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting LSB: Bring up/down networking...
[  OK  ] Started Command Scheduler.
         Starting Cleanup of Temporary Directories...
[  OK  ] Started Cleanup of Temporary Directories.
[FAILED] Failed to start LSB: Bring up/down networking.
See 'systemctl status network.service' for details.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Network.
         Starting MySQL Server...
         Starting Nginx service....
         Starting Owner service....
         Starting Php7 service....
[  OK  ] Reached target Network is Online.
[FAILED] Failed to start Nginx service..
See 'systemctl status nginx.service' for details.
[  OK  ] Started Php7 service..
[  OK  ] Started Owner service..
[  OK  ] Started MySQL Server.
2233466866 commented 2 years ago

解决方案

  1. /usr/local/nginx/为nginx的根目录,如要挂载nginx配置,请阅读文档,或只挂载配置目录/usr/local/nginx/conf/,并且请保证nginx配置正确无误。