Persist Strapi SQLite Database on Azure App Service Linux host from Docker Container

893 Views Asked by At

I'm trying to persist a Strapi SQLite database on an Azure App Service Linux host from a docker container.

I've tried using the two methods below:

  1. https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container#use-persistent-shared-storage
  2. https://learn.microsoft.com/en-us/azure/app-service/configure-connect-to-azure-storage?pivots=container-linux

Both are resulting the below error:

2020-08-30T01:48:39.664184204Z [2020-08-30T01:48:39.664Z] error Error: create table `core_store` (`id` integer not null primary key autoincrement, `key` varchar(255) null, `value` text null, `type` varchar(255) null, `environment` varchar(255) null, `tag` varchar(255) null) - SQLITE_BUSY: database is locked

Here's my docker-compose.yml:

version: '3.3'

services:
  cms:
     image: myacr.azurecr.io/repo:latest-dev
     volumes:
      - ${WEBAPP_STORAGE_HOME}/site/wwwroot/dbstore:/cms/data
     ports:
       - "80:1337"
1

There are 1 best solutions below

3
On

The error seems it's the problem of the SQLite Database, not the Azure App service. And moreover, the Azure Web App only exposes the port 80 and 443. So you need to map your port of the container you need to the port 80 or 443.