Supported tags and respective
How to use this image.
This image comes pre-packaged with a the default php extensions and configurations found on SilverStripe Platform. It also comes with some tooling pre-installed for ease-of-use.
Create using Docker Compose
Compose is a tool for defining and running multi-container Docker applications. To learn more about Compose refer to the Compose Documentation
docker-compose.yml in your SilverStripe project
version: '3' services: web: image: brettt89/silverstripe-web working_dir: /var/www volumes: - .:/var/www/html database: image: mysql volumes: - db-data:/var/lib/mysql restart: always environment: - MYSQL_ALLOW_EMPTY_PASSWORD=true volumes: db-data:
_ss_environment.php in your SilverStripe project
This defines default settings like database values, however you can add custom environment variables to this file.
<?php /* Change this from 'dev' to 'live' for a production environment. */ define('SS_ENVIRONMENT_TYPE', 'dev'); /* This defines a default database user */ define('SS_DATABASE_SERVER', 'database'); define('SS_DATABASE_NAME', 'SS_mysite'); define('SS_DATABASE_USERNAME', 'root'); define('SS_DATABASE_PASSWORD', ''); /* Configure a default username and password to access the CMS on all sites in this environment. */ define('SS_DEFAULT_ADMIN_USERNAME', 'admin'); define('SS_DEFAULT_ADMIN_PASSWORD', 'password'); // This is used by sake to know which directory points to which URL global $_FILE_TO_URL_MAPPING; $_FILE_TO_URL_MAPPING['/var/www/html'] = 'http://localhost';
Create development environment using
Run the command to build and run the Docker images:
$ docker-compose up -d
Adding nginx-proxy (multi-server)
More commonly, you will probably want to run silverstripe-web in conjunction with nginx-proxy so you can run multiple environments. This can be achieved by following these steps.
NOTE: A clone of jwilder/nginx-proxy is used https://github.com/brettt89/nginx-proxy for additional configuration options
docker network for your projects
$ docker network create my-network
This will act as a global network for each of your projects to run in simultaniously
nginx-proxy in your network
$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --net my-network --name nginx-proxy brettt89/nginx-proxy
Nginx proxy will act as a gateway for all the project environments. For best results it is recommended to use a shared root domain for each project. E.g.
Get IP of Host
Mac OSX / Linux:
Point root domain at
- For Linux / OSX based environments, we recommend the use of
- For Windows based environments, we recommend the use of Acrylic DNS
NOTE: Use the IP address obtained from the previous step (Get IP of Host).
This will point any website ending in .dev to your nginx proxy so you don't have to keep setting up records for each project.
Add my-network and VIRTUAL_HOST to your
version: '3' services: web: image: brettt89/silverstripe-web working_dir: /var/www volumes: - .:/var/www/html environment: - VIRTUAL_HOST=project1.dev database: image: mysql volumes: - db-data:/var/lib/mysql restart: always environment: - MYSQL_ALLOW_EMPTY_PASSWORD=true volumes: db-data: networks: default: external: name: my-network
Then, run the command to build and run the Docker images on each of your projects:
$ docker-compose up -d
<a name="examples"></a>Example config files
- Single-server config: docker-compose.yml
- Multi-server config: docker-compose.yml
- Environment config: _ss_environment.php
$ docker-compose exec web /bin/bash
- Web directory:
SSPAK is loaded onto the web container by default. You can mount an sspak or sspak directory directly onto the web box by adding additional volume's to your
volumes: - .:/var/www/html - ~/sspaks:/var/www/sspaks
Then you can run your
sspak commands on the web container.
$ sspak load /var/www/sspaks/project1-db-assets.sspak /var/www/html
$ sspak save /var/www/html /var/www/sspaks/project1-db-assets.sspak
docker-compose commands can be found here: https://docs.docker.com/compose/reference/overview/
Running directly with Docker
This image can also be run directly with docker. However it will need to be linked with a database in order for SilverStripe to successfully build.
$ docker run -p 3306:3306 --name database mysql $ docker run -p 80:80 -v /path/to/project:/var/www/html --link database --name project1 brettt89/silverstripe-web
Connecting with xdebug
View license information for the software contained in this image.
Supported Docker versions
This image is officially supported on Docker version 17.04.0-ce.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see the Docker installation documentation for details on how to upgrade your Docker daemon.
If you have any problems with or questions about this image, please contact us through a GitHub issue.
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
- Franco Springveldt - https://github.com/fspringveldt