Contao 3.5.X – PHP 7.2 Docker Image for Modul Development

1. Create a empty Folders data and database.

2. Create docker-compose.yml

version: '3'
services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./data:/var/www/html/
    depends_on:
      - db
    ports:
      - "3333:80"
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: my_secret_pw_shh
      MYSQL_DATABASE: test_db
      MYSQL_USER: devuser
      MYSQL_PASSWORD: devpass
      MYSQL_ROOT_HOST: '%'
    restart: always
    ports:
      - "9906:3306"
    volumes:
      - ./database:/var/lib/mysql

volumes:
  db:
    driver: local

3. Create Dockerfile

FROM php:7.2.2-apache

COPY . /var/www/html
WORKDIR /var/www/html

RUN apt-get update
RUN apt-get install -y zip unzip zlib1g-dev
RUN docker-php-ext-install zip
RUN docker-php-ext-install pcntl
RUN docker-php-ext-install mysqli
RUN apt-get update && apt-get install -y libxml2-dev \
    && pear install -a SOAP-0.13.0 \
    && docker-php-ext-install soap

4. Run docker-compose up -d on command line.

5. http://localhost:3333 ready

Views: 539