首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在docker容器中启动nginx服务(Oracle linux 7)

无法在docker容器中启动nginx服务(Oracle linux 7)
EN

Server Fault用户
提问于 2020-10-04 13:45:24
回答 1查看 702关注 0票数 0

我在Oracle Linux 7坞映像上安装了nginx(rh-nginx116-nginx)。启动容器后,在启动nginx服务时,会得到以下错误:-

代码语言:javascript
复制
 [root@7b5b3ae7d392 /]# systemctl status rh-nginx116-nginx
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Sun 2020-10-04 13:19:09 UTC; 11min ago
  Process: 264 ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 258 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 251 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116 (code=exited, status=0/SUCCESS)
  Process: 250 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
   CGroup: /docker/7b5b3ae7d3922947203ceb8164bd1746c707b0851deb7283cf84f7642564eb54/system.slice/rh-nginx116-nginx.service
           ├─270 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
           ├─271 nginx: worker process
           └─272 nginx: worker process

Oct 04 13:17:39 7b5b3ae7d392 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 04 13:17:39 7b5b3ae7d392 nginx-scl-helper[258]: nginx: the configuration file /etc/opt/rh/rh-nginx1... ok
Oct 04 13:17:39 7b5b3ae7d392 nginx-scl-helper[258]: nginx: configuration file /etc/opt/rh/rh-nginx116/n...ful
Oct 04 13:17:39 7b5b3ae7d392 systemd[1]: Refusing to accept PID outside of service control group, acqu....pid
Oct 04 13:17:39 7b5b3ae7d392 systemd[1]: Refusing to accept PID outside of service control group, acqu....pid
Oct 04 13:19:09 7b5b3ae7d392 systemd[1]: rh-nginx116-nginx.service start operation timed out. Terminating.
Oct 04 13:19:09 7b5b3ae7d392 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Oct 04 13:19:09 7b5b3ae7d392 systemd[1]: Unit rh-nginx116-nginx.service entered failed state.
Oct 04 13:19:09 7b5b3ae7d392 systemd[1]: rh-nginx116-nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

Nginx Systemd Unit文件:-

代码语言:javascript
复制
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/opt/rh/rh-nginx116/run/nginx/nginx.pid
EnvironmentFile=/opt/rh/rh-nginx116/service-environment
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid
ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116
ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t
ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true

[Install]
WantedBy=multi-user.target

请帮帮我。

EN

回答 1

Server Fault用户

发布于 2020-10-14 10:34:21

我可以在您的日志文件中看到:Refusing to accept PID outside of service control group, acqu....pid

看看这个链接。如前所述,在允许服务启动之前,systemd现在强制检查服务单元中定义的PID。

您的nginx服务单元可能与系统版本不兼容。我建议你检查一下。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1036337

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档