# InfluxDB on Docker: Error: database is locked

**URL:** <https://community.influxdata.com/t/influxdb-on-docker-error-database-is-locked/33114>\
**Category:** InfluxDB 2\
**Tags:** influxdb\
**Created:** [February 6, 2024, 3:12pm UTC](https://community.influxdata.com/t/influxdb-on-docker-error-database-is-locked/33114 "2024-02-06T15:12:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedex03](https://avatars.discourse-cdn.com/v4/letter/f/da6949/32.png) [@fedex03](https://community.influxdata.com/u/fedex03)\
**Post date:** [February 6, 2024, 3:12pm UTC](https://community.influxdata.com/t/influxdb-on-docker-error-database-is-locked/33114/1 "2024-02-06T15:12:59Z")

</div>

Hi there,

I’m deployng influxdb on docker (on a Server) using as storage for the data a CIFS share on my Nas.

I get this error:

```auto
2024-02-06T13:23:31.518836197Z	info	booting influxd server in the background	{"system": "docker"}

ts=2024-02-06T13:23:31.633544Z lvl=info msg="Welcome to InfluxDB" log_id=0nBeFjhG000 version=v2.7.5 commit=09a9607fd9 build_date=2024-01-05T17:17:04Z log_level=info

ts=2024-02-06T13:23:31.633599Z lvl=warn msg="nats-port argument is deprecated and unused" log_id=0nBeFjhG000

ts=2024-02-06T13:23:31.680445Z lvl=info msg="Resources opened" log_id=0nBeFjhG000 service=bolt path=/var/lib/influxdb2/influxd.bolt

ts=2024-02-06T13:23:31.680598Z lvl=info msg="Resources opened" log_id=0nBeFjhG000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite

ts=2024-02-06T13:23:31.686747Z lvl=info msg="Bringing up metadata migrations" log_id=0nBeFjhG000 service="KV migrations" migration_count=20

ts=2024-02-06T13:23:32.460344Z lvl=info msg="Bringing up metadata migrations" log_id=0nBeFjhG000 service="SQL migrations" migration_count=8

2024-02-06T13:23:32.522061964Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "0"}

2024-02-06T13:23:33.532295259Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "1"}

2024-02-06T13:23:34.542014974Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "2"}

2024-02-06T13:23:35.552218675Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "3"}

2024-02-06T13:23:36.562369653Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "4"}

ts=2024-02-06T13:23:37.472605Z lvl=error msg="Failed to apply SQL migrations" log_id=0nBeFjhG000 error="database is locked"

Error: database is locked

See 'influxd -h' for help

2024-02-06T13:23:37.572233232Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "5"}

/entrypoint.sh: line 284: kill: (101) - No such process

2024-02-06T13:23:37.580782226Z	error	influxd crashed during startup	{"system": "docker", "total_pings": "6"}

2024-02-06T13:23:37.582267348Z	warn	cleaning bolt and engine files to prevent conflicts on retry	{"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt", "engine_path": "/var/lib/influxdb2/engine"}

{

  "bolt-path": "/var/lib/influxdb2/influxd.bolt",

  "engine-path": "/var/lib/influxdb2/engine",

  "nats-port": 4222,

  "http-bind-address": ":9999"

}

```

This is my docker compose file:

```auto
version: "3"
services:
  influxdb:
    container_name: InfluxDb2
    image: influxdb:latest
    networks:
      - influxdb_grafana_net
    env_file:
      - influxv2.env
    volumes:
      - influxdb_cifs:/var/lib/influxdb2
      #- "/srv/docker/volumes/influxdb:/var/lib/influxdb2:rw"
    ports:
      - 8086:8086
    restart: always

volumes:
  influxdb_cifs:
    driver_opts:
      type: cifs
      o: username=influxdb,password=xxxxxx,uid=1000,gid=1000,vers=3.0
      device: //192.168.10.26/VM_Storage/InfluxDB

networks:
    influxdb_grafana_net:  
        name: influxdb_grafana_net

```

The container has access to the shared folder because I see this folder inside of network share:

- Engine folder
- influxd.sqlite

If I change the volume to one local volume with

```auto
- "/srv/docker/volumes/influxdb:/var/lib/influxdb2:rw"

```

everything works.

Any suggestion how to save the data on my NAS?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [February 6, 2024, 4:54pm UTC](https://community.influxdata.com/t/influxdb-on-docker-error-database-is-locked/33114/2 "2024-02-06T16:54:55Z")

</div>

Hello @fedex03,  
I’m sorry I haven’t seen his error before.  
Silly question but did you try :rw on the desired mount?  
There’s these related issues:

> [@Database is locked on container instance installation](https://community.influxdata.com/t/database-is-locked-on-container-instance-installation/22754):
>
> 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. 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\_d…

[https://www.reddit.com/r/prowlarr/comments/r2ncc2/database\_locked/](https://www.reddit.com/r/prowlarr/comments/r2ncc2/database_locked/)

It seems like its a nas share issue. I would consider reaching out for support through them.
