I want to create a docker image with alpine and apache. I use tini as an "init"-System. It works until i detach and reattach to the container. After attaching to the container apache exits and the container stops. I dont't know what the problem is. Do anybody had similar problems with docker, alpine and apache?
My Dockerfile looks like this (Before, I used Alpines package manager for tini)
FROM alpine
ENV TINI_VERSION v0.16.1
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /sbin/tini
RUN chmod +x /sbin/tini
RUN apk add --no-cache apache2 \
   && mkdir -p /run/apache2 \
   && ln -sf /dev/stdout /var/log/apache2/access.log \
   && ln -sf /dev/stderr /var/log/apache2/error.log
EXPOSE 80
ENTRYPOINT ["/sbin/tini", "-vvv", "-g", "--"]
CMD ["/usr/sbin/httpd", "-f", "/etc/apache2/httpd.conf", "-DFOREGROUND"]
Input and Output to docker cli:
~/Desktop/docker_test@laptop-sebi
$ docker run -itd test1
a793bad5d4350f58893909f1552c9f2978d8e2952960ac667f8dcb2bf7a3516e
~/Desktop/docker_test@laptop-sebi
$ docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             
STATUS              PORTS               NAMES
a793bad5d435        test1               "/sbin/tini -vvv -..."   12 seconds 
ago      Up 11 seconds       80/tcp              sharp_neumann
~/Desktop/docker_test@laptop-sebi
$ docker attach a7
[DEBUG tini (1)] Received SIGCHLD
[DEBUG tini (1)] Reaped child with pid: '5'
[INFO  tini (1)] Main child exited normally (with status '0')
[TRACE tini (1)] No child to wait
[TRACE tini (1)] Exiting: child has exited
Update: The problem seems to be apache2, which receives the SIGWINCH (Window Size Change) while docker attachs to the container:
[Sun Oct 15 12:13:24.592575 2017] [mpm_prefork:notice] [pid 5] AH00170: caught SIGWINCH, shutting down gracefully
[DEBUG tini (1)] Received SIGCHLD
[DEBUG tini (1)] Reaped child with pid: '5'
[INFO  tini (1)] Main child exited normally (with status '0')
[TRACE tini (1)] No child to wait
[TRACE tini (1)] Exiting: child has exited
Apache misuses the signal in conjunction with the apachectl utility to gracefully shut down the server. Is it possible to block this signal so it wouldn't be hand down to apache?
 
     
    