snippet-box icon indicating copy to clipboard operation
snippet-box copied to clipboard

Docker-image won't start // Database connection error

Open leisefuxX opened this issue 3 years ago • 8 comments
trafficstars

when i follow the instructions on github page and want to start snippet-box i get the following:

[2022-03-01 07:43:40.153 UTC+0] [INFO] db: Database connected [2022-03-01 07:43:40.178 UTC+0] [INFO] db: Found pending migrations. Executing... [2022-03-01 07:43:40.197 UTC+0] [ERROR] db: Database connection error

i deployed the container with docker (docker run ...) and docker-compose and the .yml from the repository. i sticked to the given example. error is always the same. the logs get spammed with the 3 lines given.

i am running docker on ubuntu 20.04.3 x64, latest updates and upgrades, docker from official repo. can provide any logs and outputs. just ask (:

leisefuxX avatar Mar 01 '22 07:03 leisefuxX

I am facing the same issue as well I run it on raspberry pi using the arm tag

natget21 avatar May 13 '22 00:05 natget21

+1

chrisbward avatar Jun 29 '22 15:06 chrisbward

https://github.com/pawelmalak/snippet-box/issues/34

Spotted this issue - could be because I'm using named volumes

chrisbward avatar Jun 29 '22 16:06 chrisbward

I'm getting this condition as well. Also using named volumes.

null-affinity avatar Aug 17 '22 19:08 null-affinity

I can also confirm. I kept getting an error with the following docker-compose.yml:

version: '3.3'
services:
    snippet-box:
        image: pawelmalak/snippet-box
        container_name: snippet-box
        restart: unless-stopped
        ports:
            - '5000:5000'
        volumes:
            - 'snippet-box-data:/app/data'
        networks:
            - reverse-proxy-network

volumes:
    snippet-box-data:
            external: true

networks:
    reverse-proxy-network:
        external: true

I changed the Volume to a Bind Mount in the following docker-compose.yml file and it has been working fine for me.

version: '3.3'
services:
    snippet-box:
        image: pawelmalak/snippet-box
        container_name: snippet-box
        restart: unless-stopped
        ports:
            - '5000:5000'
        volumes:
            - './data:/app/data'
        networks:
            - reverse-proxy-network

networks:
    reverse-proxy-network:
        external: true

Trevo525 avatar Sep 19 '22 06:09 Trevo525

For those running into this error; This appears to be a file system permission issue. At least when working with bind mounts.

Ran into the same thing on first deployment where docker (as the root user) would create the local directory and the container running as the node user (ID 1000) could not create the DB file.

After running a chown -R 1000:1000 on the snippet-box directory all works fine.

RoboMagus avatar Mar 13 '24 15:03 RoboMagus

Has there been any progress on this one? I enjoy using snippet-box but following this thread it appears to have a bug surrounding named docker volumes. I had been using a bind mount happily but recently tried to move to a volume and no matter what I do I can't seem to get the container to even start. If I had logs it would be helpful but the container just flat out won't start. I suspected it was a permissions issue as person above listed but no permissions seem to fix it.

sysblob avatar Mar 28 '24 05:03 sysblob