SQLite Docker Compose

SQLite 3 Docker Compose

While we are talking about docker-compose powered databases, here is SQLite 3. Because, why not?

docker-compose -f ~/desh/docker-composers/sqlite3/docker-compose.yml up --build -d;

Contents of your docker-compose.yml file:

version: '3'

services:
  sqlite3:
    container_name: sqlite3_container
    image: nouchka/sqlite3:latest
    stdin_open: true
    tty: true
    volumes:
      #Modify following line
      - path-to/your/databases/sqlite3:/root/db/
    ports:
      - '9000:9000' # expose ports - HOST:CONTAINER
    restart: unless-stopped

Published by

mustafabugra

Systems Engineer

3 thoughts on “SQLite 3 Docker Compose”

  1. Hello Mustafa,
    I used your docker compose file to setup a SQlite3 on a ubuntu server 20.04.
    It worked well thanks for share it.
    Using docker shell console I create database and tables.
    I have also install on docker node-red, and I want to use node-red to work with the database.
    Here comes my problem, that I node-red can’t access the database.
    this is the error message:
    Node-Red failed to open /home/iot/IOTstack/volumes/sqlite3/nodered.db
    I give the r/w permissions to the database.

    Can you point me how to fix this?
    Thanks for your time

    1. Hello Lucian,
      As far as I know, that may be because of several reasons. One of them is permissions, not your user but docker needs to have access to proper volumes.
      Also someone had a similar problem like yours in stackoverflow. Link (Not inside docker though.)
      If you can share your compose file, I can try to recreate your problem.

      Have a nice day.

  2. Hello Mustafa,
    I got errors with this container:
    “sqlite3_container exited with code 1”. Please help.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.