TYPO3 for docker

Docker container bundle for TYPO3

  • 16.12.2018
  • 16.05.2019
  • Software
  • Pascal R.

Tested with TYPO3 v8 and v9. Should be compatible with v7 too!

Preamble

This container bundle provides three containers to run your TYPO3 websites with docker. It should also be scalable in case of using things like kubernetes e.g. with AWS.

To-do

  • Use typo3-utilities for php-cgi instead of typo3-php due to caching issues
  • Make a list of available tools and add them to this page (e.g. deployer, surf)
  • Add examples how to use TYPO3 scheduler
  • Test container with kubectl and provide an example
  • Label containers by TYPO3 version for long time compatibility with older versions

Feel free to give feedback :)

Source code and issue tickets

Found an issue? Feel free to create an issue ticket and/or a merge request or if you don´t wan´t to register on my GitLab you can send me a mail via contact form.

You can find the source code of all container on my gitlab.

typo3-apachetypo3-phptypo3-utilities

 

Settings for typo3-apache container

The following things can be configured using environment variables e.g. in your docker-compose file

Environment variabledefault valuedescription

DOCUMENT_ROOT

/usr/local/apache2/htdocs/publicThe entrypoint of your website. Default for composer based projects.

SERVER_ADMIN 

pleaseSetTheEnvironment@variable.tldContact mail that will be displayed in some apache error messages. See here

 

Settings for typo3-utilities container

The following things can be configured using environment variables e.g. in your docker-compose file

Environment variabledefault valuedescription

DOCUMENT_ROOT 

same as typo3-apacheIf you customize this setting on the typo3-apache container then you also need to set the same value for typo3-utilities container! See here

START_SSH_SERVER

trueStarts an openssh server on port 22 if set to true. Put your public key into /home/typo3/.ssh/authorized_keys

 

Example docker-compose

version: '3.6'

services:
  web:
    container_name: mywebsite_web
    depends_on:
      - db
    environment:
      - PHP_SERVICE_NAME=mywebsite_php
    image: kronova/typo3-apache
    networks:
      - private
      - web
    ports:
      - 80:80
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs:ro
  utilities:
    container_name: mywebsite_utilities
    depends_on:
      - db
    image: kronova/typo3-utilities
    networks:
      - private
    ports:
      - "2222:22"
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs
      - ssh:/home/typo3/.ssh
  php:
    container_name: mywebsite_php
    depends_on:
      - db
    image: kronova/typo3-php
    networks:
      - private
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs
  db:
    container_name: mywebsite_db
    command:
      - --character-set-server=utf8
      - --collation-server=utf8_unicode_ci
    environment:
      - MYSQL_USER=typo3
      - MYSQL_PASSWORD=badPasswordChangeIt
      - MYSQL_DATABASE=typo3
      - MYSQL_ROOT_PASSWORD=veryBadForRoot
    image: mariadb:10.4
    networks:
      - private
    restart: always
    volumes:
      - mysql:/var/lib/mysql

networks:
  private:
  web:
    external: true
volumes:
  htdocs:
  mysql:
  ssh:

 

 

Example docker-compose with traefik labels

Take a look into this example if you´re using traefik as proxy.

 

version: '3.6'

services:
  web:
    container_name: mywebsite_web
    depends_on:
      - db
    environment:
      - PHP_SERVICE_NAME=mywebsite_php
    image: kronova/typo3-apache
    labels:
      - "traefik.docker.network=web"
      - "traefik.enable=true"
      - "traefik.basic.frontend.rule=Host:domain.tld"
      - "traefik.basic.port=80"
      - "traefik.basic.protocol=http"
    networks:
      - private
      - web
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs:ro
  utilities:
    container_name: mywebsite_utilities
    depends_on:
      - db
    image: kronova/typo3-utilities
    networks:
      - private
    ports:
      - "2222:22"
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs
      - ssh:/home/typo3/.ssh
  php:
    container_name: mywebsite_php
    depends_on:
      - db
    image: kronova/typo3-php
    networks:
      - private
    restart: always
    volumes:
      - htdocs:/usr/local/apache2/htdocs
  db:
    container_name: mywebsite_db
    command:
      - --character-set-server=utf8
      - --collation-server=utf8_unicode_ci
    environment:
      - MYSQL_USER=typo3
      - MYSQL_PASSWORD=badPasswordChangeIt
      - MYSQL_DATABASE=typo3
      - MYSQL_ROOT_PASSWORD=veryBadForRoot
    image: mariadb:10.4
    networks:
      - private
    restart: always
    volumes:
      - mysql:/var/lib/mysql

networks:
  private:
  web:
    external: true
volumes:
  htdocs:
  mysql:
  ssh: