Need some help mounting a docker volume for the api keys

I seem to be doing something wrong as I am getting permission errors.

i.e.

libretranslate  | Traceback (most recent call last):                                                                                                 
libretranslate  |   File "./venv/bin/libretranslate", line 33, in <module>                                                                           
libretranslate  |     sys.exit(load_entry_point('libretranslate==1.3.8', 'console_scripts', 'libretranslate')())                                     
libretranslate  |   File "/app/venv/lib/python3.8/site-packages/libretranslate/main.py", line 176, in main                                           
libretranslate  |     app = create_app(args)                                                                                                         
libretranslate  |   File "/app/venv/lib/python3.8/site-packages/libretranslate/app.py", line 159, in create_app                                      
libretranslate  |     api_keys_db = Database(args.api_keys_db_path)                                                                                  
libretranslate  |   File "/app/venv/lib/python3.8/site-packages/libretranslate/api_keys.py", line 28, in __init__                                    
libretranslate  |     self.c = sqlite3.connect(db_path, check_same_thread=False)                                                                     
libretranslate  | sqlite3.OperationalError: unable to open database file

I tried these:

    volumes:                                                                                                                                         
      - ./data/api_keys:/app/db/api_keys.db

    volumes:                                                                                                                                         
      - ./data/api_keys/:/app/db/api_keys.db

I entered the running container to figure out what owner and permissions I need for this folder so I tried:

chown -R 1032:1032 data/ and chmod -R 770 data/ but am still getting the same error.

btw. if I don’t mount the volume for the api keys all works well but I would like to persist the keys

solved the problem, went with:

    volumes:                                                                                                                                         
      - ./data/api_keys:/app/db
1 Like