Docker image for Strapi development, based on gilhardl/node
Start CLI :
docker run -it --name strapi -v /path/to/your/project:/usr/src/api gilhardl/strapi
Start CLI and expose port to be able to start the app :
docker run -it --name strapi -v /path/to/your/project:/usr/src/api gilhardl/strapi -p 1337:1337 --link yourapp-db:mongo
Note :
yourapp-db is the name of your MongoDB container-p 1337:1337 or --link yourapp-db:mongo parameters.docker volume create mongodb-data
docker run -it --name yourapp-db -p 27017:27017 -v mongodb-data:/data/db -e MONGO_INITDB_DATABASE=yourapp mongo
docker run -it --name strapi -v /path/to/your/project:/usr/src/api -p 1337:1337 --link yourapp-db:mongo gilhardl/strapi
Create a project :
strapi new yourapp-api
? Choose your installation type Custom (manual settings)
? Choose your main database: MongoDB
? Database name: yourapp
? Host: yourapp-db
? +srv connection: false
? Port (It will be ignored if you enable +srv): 27017
? Username:
? Password:
? Authentication database (Maybe "admin" or blank):
? Enable SSL connection: false
...
Start API :
strapi start
Create a file named docker-compose.yml at your project root like the following :
version: '3'
services:
api:
container_name: yourapp-api
build: .
image: gilhardl/strapi
ports:
- 1337:1337
volumes:
- .:/usr/src/api/
depends_on:
- db
command: strapi start
restart: always
db:
container_name: yourapp-db
image: mongo
environment:
- MONGO_INITDB_DATABASE=yourapp
ports:
- 27017:27017
volumes:
- mongodb-data:/data/db
restart: always
volumes:
mongodb-data:
Start database and API :
docker-compose up
MIT
Content type
Image
Digest
Size
364.8 MB
Last updated
over 7 years ago
docker pull gilhardl/strapi