Sign inSign up

blackpepper/craftcms

By blackpepper

•Updated over 5 years ago

Docker image for Craft CMS.

Image
4

10K+

blackpepper/craftcms repository overview

⁠docker-craftcms

Docker image for Craft CMS⁠. Available on Docker Hub as blackpepper/craftcms⁠.

⁠Usage

First start a MySQL database for Craft:

docker run --name database \
	-e MYSQL_ROOT_PASSWORD=password \
	-e MYSQL_USER=craft \
	-e MYSQL_PASSWORD=password \
	-e MYSQL_DATABASE=craft \
	-d mariadb:10

Then run Craft:

docker run --name craftcms \
	-e DB_SERVER=database \
	-e DB_USER=craft \
	-e DB_PASSWORD=password \
	-e DB_DATABASE=craft \
	-e DB_DRIVER=mysql \
	--link database \
	-p 8080:80 \
	-d blackpepper/craftcms

Visit http://localhost:8080/admin⁠ to create a site.

⁠Docker Compose

Alternatively use Docker Compose:

version: '2.4'

services:

  craftcms:
    image: blackpepper/craftcms
    environment:
      DB_SERVER: database
      DB_USER: craft
      DB_PASSWORD: password
      DB_DATABASE: craft
      DB_DRIVER: mysql
    links:
      - database
    ports:
      - 8080:80

  database:
    image: mariadb:10
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: craft
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: craft
    ports:
      - 3306:3306

See the demo⁠ project to see this in action.

⁠Tags

The following Docker image tags are available:

Craft VersionTag
3latest⁠
22⁠

⁠Configuration

Use the following environment variables to configure Craft at runtime:

Variable NameCraft Setting
DB_DSNmysql:host=localhost;port=3306;dbname=craft⁠
DB_USERuser⁠
DB_PASSWORDpassword⁠
CRAFT_ALLOW_UPDATESallowUpdates⁠
CRAFT_COOLDOWN_DURATIONcooldownDuration⁠
CRAFT_DEV_MODEdevMode⁠
CRAFT_ENABLE_TEMPLATE_CACHINGenableTemplateCaching⁠
CRAFT_MAX_UPLOAD_FILE_SIZEmaxUploadFileSize⁠
CRAFT_OMIT_SCRIPT_NAME_IN_URLSomitScriptNameInUrls⁠
CRAFT_PHP_MAX_MEMORY_LIMITphpMaxMemoryLimit⁠
CRAFT_SITE_URLsiteUrl⁠
CRAFT_TRANSFORM_GIFStransformGifs⁠
CRAFT_USE_COMPRESSED_JSuseCompressedJs⁠
CRAFT_USER_SESSION_DURATIONuserSessionDuration⁠

⁠Customisation

Use as a base image to customise Craft templates and public assets:

FROM blackpepper/craftcms

COPY public /var/www/web
COPY templates /var/www/templates

⁠Version

This image aspires to track the latest build of Craft CMS 3. Use the following build arguments to customise the Craft CMS version at build time:

ArgumentDescription
CMS_VERSIONThe version of Craft CMS to use, e.g. 3.6.5.1
CRAFT_VERSIONThe version of the Craft CMS starter to use, e.g. 1.1.2

For example, to build an image for Craft CMS version 3.6.5.1:

docker build --build-arg CMS_VERSION=3.6.5.1 --build-arg CRAFT_VERSION=1.1.2 .

Tag summary

Content type

Image

Digest

Size

276.5 MB

Last updated

over 5 years ago

docker pull blackpepper/craftcms