2020-02-10 14:21:18 +01:00
# Installing using Docker
If you're already familiar with Docker, you are probably looking for our official Docker images over [Docker Hub ](https://hub.docker.com/r/strapi/strapi ).
[[toc]]
## Step 1: Create a `docker-compose.yaml` file
2020-02-20 19:00:52 +01:00
Create this `docker-compose.yaml` file in an empty folder. < br >
A fresh new Strapi application will be created where the `docker-compose.yaml` file is located.
2020-02-10 14:21:18 +01:00
This docker-compose defines our database and Strapi service and links them.
:::: tabs
::: tab SQLite
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
```yaml
2020-02-20 19:00:52 +01:00
version: '3'
2020-02-10 14:21:18 +01:00
services:
strapi:
image: strapi/strapi
volumes:
- ./:/srv/app
ports:
2020-02-20 19:00:52 +01:00
- '1337:1337'
2020-02-10 14:21:18 +01:00
```
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
:::
::: tab Postgres
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
```yaml
2020-02-20 19:00:52 +01:00
version: '3'
2020-02-10 14:21:18 +01:00
services:
strapi:
image: strapi/strapi
environment:
DATABASE_CLIENT: postgres
DATABASE_NAME: strapi
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
links:
- postgres:postgres
volumes:
- ./app:/srv/app
ports:
2020-02-20 19:00:52 +01:00
- '1337:1337'
2020-02-10 14:21:18 +01:00
postgres:
image: postgres
environment:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
volumes:
2020-02-20 19:00:52 +01:00
- ./data:/data/postgres
2020-02-10 14:21:18 +01:00
ports:
2020-02-20 19:00:52 +01:00
- '5432:5432'
2020-02-10 14:21:18 +01:00
```
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
:::
::: tab MongoDB
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
```yaml
2020-02-20 19:00:52 +01:00
version: '3'
2020-02-10 14:21:18 +01:00
services:
strapi:
image: strapi/strapi
environment:
DATABASE_CLIENT: mongo
DATABASE_NAME: strapi
DATABASE_HOST: mongo
DATABASE_PORT: 27017
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
links:
- mongo:mongo
volumes:
- ./app:/srv/app
ports:
2020-02-20 19:00:52 +01:00
- '1337:1337'
2020-02-10 14:21:18 +01:00
mongo:
2020-03-03 21:23:56 +02:00
image: mongo
2020-02-10 14:21:18 +01:00
environment:
MONGO_INITDB_ROOT_USERNAME: strapi
MONGO_INITDB_ROOT_PASSWORD: strapi
volumes:
2020-02-20 19:00:52 +01:00
- ./data/db:/data/db
2020-02-10 14:21:18 +01:00
ports:
2020-02-20 19:00:52 +01:00
- '27017:27017'
2020-02-10 14:21:18 +01:00
```
2020-02-20 19:00:52 +01:00
2020-02-10 14:21:18 +01:00
:::
::::
## Step 2: Pull the latest images
```
docker-compose pull
```
## Step 3: Run the stack
```
docker-compose up -d
2020-02-20 19:00:52 +01:00
```