Je veux créer une image docker avec alpine et apache. J'utilise tini comme un système "init". Cela fonctionne jusqu'à ce que je détache et me rattache au récipient. Après la fixation sur le conteneur apache quitte et le conteneur s'arrête. Je ne sais pas quel est le problème. Quelqu'un a-t-il eu des problèmes similaires avec docker, alpine et apache?Apache avec Docker Alpine Linux
Mon Dockerfile ressemble à ceci (Avant, je gestionnaire de paquets Alpines pour 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"]
entrée et de sortie docker cli:
~/Desktop/[email protected]
$ docker run -itd test1
a793bad5d4350f58893909f1552c9f2978d8e2952960ac667f8dcb2bf7a3516e
~/Desktop/[email protected]
$ 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/[email protected]
$ 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
Mise à jour: Le problème semble être apache2, qui reçoit le SIGWINCH (changement de taille de fenêtre) tandis que le docker s'attache au iner:
[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 abuse du signal en liaison avec l'utilitaire apachectl pour fermer correctement le serveur. Est-il possible de bloquer ce signal afin qu'il ne soit pas transmis à Apache?
Je cherche une solution qui ne limite pas la façon dont vous exécutez le conteneur docker par exemple avec -t ou non. – Sebi2020
@ Sebi2020 OK, mais d'abord, garderais-tu le travail dans votre cas? – VonC
Oui, si je ne connecte pas un tty, le signal n'est pas envoyé. – Sebi2020