Re(rerererer)-starting Docker

I had a hell of a time getting a Docker development environment started. I keep trying once a year, as I know that's the modern thing, but each time I find it more trouble than it's worth. If I can just run up an Apache+PHP setup on my machine... why bother with Docker? But... sigh.

I've tried again. For about 3 hours I wrestled with php:7.2-apache, but I've got it to at least Start to work.

  • I'm just copying my directory from my base machine for now. Doesn't fully work, so a build chain will be required.
  • I've put a docker file in my repository. Should make it .docker I suppose.
  • Activating the modules required in apache was trial and error.
  • Finding where the php.ini-development to copy was annoying
  • I'm installing libgnutls26 & libgnutls27 to create a certificate on the box, to prevent any weirdness

Behold, my current Dockerfile.

FROM php:7.2-apache

# ROOT
COPY dist/ /var/www/
ENV APACHE_DOCUMENT_ROOT /var/www/web
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

ADD ./docker/httpd-ssl.conf /etc/apache2/sites-enabled/000-default.conf
RUN ln -s /etc/apache2/mods-available/ssl.load  /etc/apache2/mods-enabled/ssl.load
RUN ln -s /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load
RUN ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

RUN mv "/usr/local/etc/php/php.ini-development" "/usr/local/etc/php/php.ini"

RUN mkdir -p /etc/apache2/ssl/
RUN apt-get update; apt-cache policy libgnutls26
RUN apt-get update; apt-cache policy libgnutls27
RUN openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj \
    "/C=AU/ST=Queensland/L=Brisbane/O=CupboardInc/CN=dev.vonexplaino.com" \
    -keyout /etc/apache2/ssl/ssl.key -out /etc/apache2/ssl/ssl.crt

RUN mkdir -p /var/run/apache2/

EXPOSE 443

It's finally accepting connections from my machine on port 443. Failing nastilly, but that's due to the simple copy of code. Now to figure out how to do a deploy onto the box of what I want. Baby steps.

UPDATE: More learnings, to follow the log file: docker service logs arch_risk-management_web -f