Today I finally had some time to cleaned up my Dockerfile for Magento 2. I am using Alpine Linux for most of my Magento 2 projects which usually includes NGINX, PHP-FPM and MariaDB.
# Use Alpine Linux
# Declare maintainer
MAINTAINER Tobias Forkel <email@example.com>
ENV TIMEZONE Australia/Melbourne
RUN addgroup -g 1000 www && \
adduser -S www -G www -s /sbin/nologin -D
ADD https://repos.php.earth/alpine/phpearth.rsa.pub /etc/apk/keys/phpearth.rsa.pub
RUN echo "https://repos.php.earth/alpine/v3.7" >> /etc/apk/repositories
RUN apk --no-cache add \
While testing my updated Dockerfile I came across the following PHP notice which prevented the deployment scripts from finishing the Magento 2 setup.
Notice: Use of undefined constant T_CURLY_OPEN - assumed 'T_CURLY_OPEN' in /var/www/src/setup/src/Magento/Setup/Module/ Di/Code/Reader/FileClassScanner.php on line 72
The problem was simply a missing PHP extension php7.1-tokenizer which has resolved the issue after re-creating the container with –build.
docker-compose up -d --build
Today I successfully installed my first October CMS project locally via composer / command line. The installation was pretty straightforward and worked surprisingly well on my Alpine Linux docker container which includes NGINX, PHP-FPM and MariaDB.
- v1.0.1: First version of Demo
,,,. ,@@@@@@/@@, .oo8888o.
%&&%/ %&%%&&@@\ V /@@' `88\8 `/88'
`&%\ ` /%&' |.| \ '|8'
|o| | | | |
|.| | | | |
`========= INSTALLATION COMPLETE ========='
However, when I tried to open the front-end I got the following error.
PHP message: PHP Fatal error: Interface 'SessionHandlerInterface' not found in /var/www/src/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php on line 10
After a quick research I found the solution on Stackoverflow. I basically forgot to install the PHP extension php7-session inside my docker container. I manually installed the missing extension, but also updated my Dockerfile in case I have to rebuild my container.
bash-4.4# apk add php7-session
(1/1) Installing php7-session (7.1.33-r0)
OK: 291 MiB in 87 packages
After that I manually killed all PHP processes to make sure php-fpm loads the new extension with the next page reload.