Apache2 problem

67 views
Skip to first unread message

rafa...@gmail.com

unread,
Mar 2, 2019, 7:45:12 AM3/2/19
to passenger-docker
I'm trying to run just a plain Apache server. This is a part of my Dockerfile:

RUN mkdir /etc/service/apache
COPY apache-wuhu.sh /etc/service/apache/run
RUN chmod +x /etc/service/apache/run

The apache-wuhu.sh script is so simple:

#!/bin/sh
exec /usr/sbin/apache2ctl -D FOREGROUND

When I run docker-compose up it seems everything's OK:
 
root@4d0261d4eb42:/# pstree
my_init─┬─runsvdir─┬─runsv
        │          ├─runsv───cron
        │          └─runsv───apache2ctl───apache2───5*[apache2]
        └─syslog-ng

Now, when I try to stop apache2 service it's going funky:

root@4d0261d4eb42:/# sv stop apache2
ok: down: apache2: 0s, normally up
root@4d0261d4eb42:/# pstree
my_init─┬─apache2───5*[apache2]
        ├─runsvdir─┬─2*[runsv]
        │          └─runsv───cron
        └─syslog-ng
root@4d0261d4eb42:/# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 /usr/bin/python3 -u /sbin/my_init
   12 ?        S      0:00 /usr/sbin/syslog-ng --pidfile /var/run/syslog-ng.pid -F --no-caps
   18 ?        S      0:00 /usr/bin/runsvdir -P /etc/service
   19 ?        Ss     0:00 runsv sshd
   20 ?        Ss     0:00 runsv cron
   21 ?        Ss     0:00 runsv apache2
   22 ?        S      0:00 /usr/sbin/cron -f
   25 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   26 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   27 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   28 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   29 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   30 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   31 pts/0    Ss     0:00 bash -l
   51 pts/0    R+     0:00 ps ax

From now on, the service becomes Schrodinger's server, it won't start yet it runs [run by my-init]:

root@4d0261d4eb42:/# sv start apache2
ok: run: apache2: (pid 59) 0s
root@4d0261d4eb42:/# pstree
my_init─┬─apache2───5*[apache2]
        ├─runsvdir─┬─2*[runsv]
        │          └─runsv───cron
        └─syslog-ng
root@4d0261d4eb42:/# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 /usr/bin/python3 -u /sbin/my_init
   12 ?        S      0:00 /usr/sbin/syslog-ng --pidfile /var/run/syslog-ng.pid -F --no-caps
   18 ?        S      0:00 /usr/bin/runsvdir -P /etc/service
   19 ?        Ss     0:00 runsv sshd
   20 ?        Ss     0:00 runsv cron
   21 ?        Ss     0:00 runsv apache2
   22 ?        S      0:00 /usr/sbin/cron -f
   25 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   26 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   27 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   28 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   29 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   30 ?        S      0:00 /usr/sbin/apache2 -D FOREGROUND
   31 pts/0    Ss     0:00 bash -l
  282 pts/0    R+     0:00 ps ax

And the container is stuck in re-starting it [no wonder...]:
wuhu_1     | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.16.3. Set the 'ServerName' directive globally to suppress this message
wuhu_1     | httpd (pid 25) already running

What am I doing wrong here? Why is myinit reinstating the service in the first place?


Reply all
Reply to author
Forward
0 new messages