SQLiteError when starting the image in Docker
Describe the bug When I start the container in docker (on a Mac) I get an error message:
Bun v1.2.2 (Linux x64 baseline) ConvertX v0.14.1 1 | import { Database } from "bun:sqlite"; 2 | 3 | const db = new Database("./data/mydb.sqlite", { create: true }); ^ SQLiteError: unable to open database file errno: 14, byteOffset: -1, code: "SQLITE_CANTOPEN" at new Database (bun:sqlite:236:28) at /app/src/db/db.ts:3:12
To Reproduce Steps to reproduce the behavior:
- Go to Docker and click play to start the image. Image is up to date for c4illin/convertx:latest
- Click on logs
- See error message above
Checklist:
- [X] I am accessing ConvertX over HTTPS or have
HTTP_ALLOWED=true
I had this too, initially I had the folder setup incorrectly for the Docker mount.
Once I fixed that it worked great.
Here is my full configuration if it helps:
convertx:
image: ghcr.io/c4illin/convertx
container_name: convertx
restart: unless-stopped
ports:
- "3000:3000"
environment:
- JWT_SECRET=${CONVERTX_JWT_SECRET}
- HTTP_ALLOWED=true
- ALLOW_UNAUTHENTICATED=true
- TZ=Europe/London
- AUTO_DELETE_EVERY_N_HOURS=72
volumes:
- /home/user/convertx:/app/data
This is a permission issue or bad volume/mountpoint declaration. Verify your volumes section and paths;
/this/is/the/real/path:/this/is/the/app/path
So /home/user/convertx_dir:/app/data as Rooster212 pointed out. You shouldn't have permission errors if you are in your home directory. If you are elsewhere, you will need to do some chmod and possibly chown's.
Having the same error
I made sure the path is correct and even made sure permissions are correct.
below is my config file
services:
convertx:
build:
context: .
# dockerfile: Debian.Dockerfile
environment: # Defaults are listed below. All are optional.
- ACCOUNT_REGISTRATION=true # true or false, doesn't matter for the first account (e.g. keep this to false if you only want one account)
- JWT_SECRET= #will use randomUUID() by default
- HTTP_ALLOWED=true # setting this to true is unsafe, only set this to true locally
- ALLOW_UNAUTHENTICATED=true # allows anyone to use the service without logging in, only set this to true locally
- AUTO_DELETE_EVERY_N_HOURS=24 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
# - FFMPEG_ARGS=-hwaccel vulkan # additional arguments to pass to ffmpeg
# - WEBROOT=/convertx # the root path of the web interface, leave empty to disable
# - HIDE_HISTORY=true # hides the history tab in the web interface, defaults to false
- TZ=Europe/Stockholm # set your timezone, defaults to UTC
ports:
- 3000:3000
volumes:
- /home/user/git_repos/ConvertX/data:/app/data
As folks mentioned earlier it's likely a permission issue. I'm using fedora where SELinux is enabled by default so chmod-attempts to grant more permissions to the mounted folder didn't make any effect. Smth similar to ... helped me:
mkdir /var/convertx-data
semanage fcontext -a -t container_file_t "/var/convertx-data(/.\*)?" && restorecon -Rv /var/convertx-data
docker run -p 3000:3000 -v /var/convertx-data:/app/data ghcr.io/c4illin/convertx