/strapi-docker

Install and run your first Strapi project using Docker

Primary LanguageShellMIT LicenseMIT

Strapi containerized

Strapi

API creation made simple, secure and fast. The most advanced open-source Content Management Framework to build powerful API with no effort.


Travis GitHub release Docker Pulls

Quickstart (recommended)

Read the Medium post to have full explaination

  1. git clone https://github.com/strapi/strapi-docker && cd strapi-docker
  2. Run using docker-compose up

Pull from Docker Hub

docker pull strapi/strapi

Then run image

Start a database (e.g. MongoDB)

docker run -e MONGO_INITDB_DATABASE=strapi \
           -v `pwd`/db/:/data/db \
           --name strapi-mongo \
           -d mongo

Start strapi

docker run -e APP_NAME=strapi-app \
           -e DATABASE_CLIENT=mongo \
           -e DATABASE_HOST=strapi-mongo \
           -e DATABASE_PORT=27017 \
           -e DATABASE_NAME=strapi \
           -v `pwd`/strapi-app:/usr/src/api/strapi-app \
           --link strapi-mongo:mongo \
           -p 1337:1337 \
           --name strapi -d strapi/strapi

You should the be able to access your Strapi installation at localhost:1337.

Use as base image

FROM strapi/strapi

Environment variables

  • APP_NAME to override the strapi-app generated folder name (you should also update the volumes paths).
  • DATABASE_CLIENT a database providers supported by Strapi: MongoDB, Postgres, MySQL, Sqlite3 and Redis.
  • DATABASE_HOST database service name.
  • DATABASE_PORT depends on your database client.
  • DATABASE_NAME initializes a database with specific name (default strapi). When using MongoDB, you should also update the MONGO_INITDB_DATABASE environment in the db service.
  • DATABASE_USERNAME set the username of the database connection.
  • DATABASE_PASSWORD set the password of the database connection.
  • DATABASE_SSL boolean for SSL.
  • DATABASE_AUTHENTICATION_DATABASE set the authentification.