# Database is locked on container instance installation

**URL:** <https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754>\
**Category:** InfluxDB 2\
**Tags:** getting-started\
**Created:** [December 1, 2021, 2:57am UTC](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754 "2021-12-01T02:57:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![D.Lee](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/d.lee/32/8860_2.png) [@D.Lee](https://community.influxdata.com/u/D.Lee)\
**Post date:** [December 1, 2021, 2:57am UTC](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754/1 "2021-12-01T02:57:10Z")

</div>

I have set up InfluxDB 2.1.1 in an Azure Container Instance and have mounted a new Azure FileShare to /var/lib/influxdb2 .  
On starting the pod, it terminates and I see the following logs appear.

```auto
2021-12-01T01:37:38.294145622Z	warn	boltdb not found at configured path, but DOCKER_INFLUXDB_INIT_MODE not specified, skipping setup wrapper	{"system": "docker", "bolt_path": ""}
ts=2021-12-01T01:37:38.484185Z lvl=info msg="Welcome to InfluxDB" log_id=0Y8v50hl000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
ts=2021-12-01T01:37:38.532866Z lvl=info msg="Resources opened" log_id=0Y8v50hl000 service=bolt path=/var/lib/influxdb2/influxd.bolt
ts=2021-12-01T01:37:38.532954Z lvl=info msg="Resources opened" log_id=0Y8v50hl000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
ts=2021-12-01T01:37:38.545548Z lvl=info msg="Bringing up metadata migrations" log_id=0Y8v50hl000 service="KV migrations" migration_count=18
ts=2021-12-01T01:37:39.855620Z lvl=info msg="Bringing up metadata migrations" log_id=0Y8v50hl000 service="SQL migrations" migration_count=3
Error: database is locked
See 'influxd -h' for help
ts=2021-12-01T01:37:44.890982Z lvl=error msg="Failed to apply SQL migrations" log_id=0Y8v50hl000 error="database is locked"

```

In the file share the file influxd.sqlite has been created with 0 B along with the bolt file and engine directory.

I had set up an Azure FileShare with 100Gb with SMB protocol and used the following command to create the ACI (with identifiers removed). The FileShare and the ACI are located in the same resource group and location (West Europe)

```auto
az container create \
    --resource-group <group> \
    --name <name> \
    --image influxdb:2.1.1 \
    --restart-policy OnFailure \
    --memory 8 \
    --dns-name-label <label> \
    --ports 80 8086 \
    --azure-file-volume-account-name <account> \
    --azure-file-volume-account-key <key> \
    --azure-file-volume-share-name <share name> \
    --azure-file-volume-mount-path /var/lib/influxdb2

```

The details of the file share are below

```auto
SIZE AND PERFORMANCE
Used capacity	:	64 KiB
Provisioned capacity	:	100 GiB
Maximum IO/s	:	500
Burst IO/s	:	4000
Throughput rate	:	70.0 MiBytes / s

```

I note that this error occurs using the Influx 2.1.1 image. The previous version 2.0.9 (image given was at [quay.io](http://quay.io)) worked with no issue (mount point was at /root, new one is at /var/lib/influxdb2), but it does not have the SQL migrations appear in the logs.

Have I missed something during the setup?

---

<div class="post-metadata">

**Author:** ![JBustin](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jbustin/32/9000_2.png) [@JBustin](https://community.influxdata.com/u/JBustin)\
**Post date:** [December 14, 2021, 3:33pm UTC](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754/2 "2021-12-14T15:33:17Z")

</div>

Same here. I found this in an article:

Unfortunately, due to some [limitations](https://docs.microsoft.com/fr-fr/rest/api/storageservices/features-not-supported-by-the-azure-file-service), it was not possible to persist on Azure Files the SQLite database (embarked by default in Grafana) (a dark story about locks) or to use the Docker image provided by PostgreSQL (a dark story about files and their owner).

> **[Grafana and InfluxDB on Azure Container Instances](https://r3dlin3.github.io/2020/05/29/aci-grafana-influxdb-en/)**
>
> Azure Container Instances allow to run containers. Here he is a small example with a group of containers of Grafana and InfluxDB.

It seems that sqlite cannot run properly on azure fs because some features are missing.  
Have you found a workaround ?

Regards

---

<div class="post-metadata">

**Author:** ![D.Lee](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/d.lee/32/8860_2.png) [@D.Lee](https://community.influxdata.com/u/D.Lee)\
**Post date:** [December 23, 2021, 4:38am UTC](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754/3 "2021-12-23T04:38:53Z")

</div>

I did see that, but didn’t think it would be the same issue since the system did create a file.

Sadly I have not been able to find a work around.  
I have been continuing to work with InfluxDB 2.0.9 for the time being.

---

<div class="post-metadata">

**Author:** ![SWSBB](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@SWSBB](https://community.influxdata.com/u/SWSBB)\
**Post date:** [April 9, 2024, 8:36pm UTC](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754/4 "2024-04-09T20:36:26Z")

</div>

I had the same issue. But I resolved it by using NFS file shares instead of SMB.  
This is a bit more complex to setup in Azure but once done it works really well =)

Things you need:

- VNet
- SubNet
- Premium Storage Account + SubNet ACL
- NFS File Share
- Managed Container Env + NFS Azure File Share

From there it’s no difference to mount these inside the container app
