The following docker-compose examples using the docker image aosingh/sqlite_rx
sqlite-server CLI is used in all the docker examples
In-memory SQLite Database
version: "3"
services:
sqlite_server:
image: aosingh/sqlite_rx
command: sqlite-server --log-level DEBUG
ports:
- 5000:5000
- Note that in the docker container the server listens on port
5000so, do enable port forwarding on the host machine
On Disk SQLite Database with Backup
docker volume is used to persist the database file on the host’s file system
version: "3"
services:
sqlite_server:
image: aosingh/sqlite_rx
command: sqlite-server --log-level DEBUG --database /data/database.db --backup-database /data/backup.db
ports:
- 5000:5000
volumes:
- data:/data
volumes:
data: {}
- Named docker volume
datais mounted to/datalocation in the container sqlite-serverCLI accepts--databaseoption which is the database path in the container. Form is/data/<dbname>.db
SQLite Database server with CurveZMQ encryption
version: "3"
services:
sqlite_server:
image: aosingh/sqlite_rx
command: sqlite-server --curvezmq --log-level DEBUG --database /data/database.db --key-id id_server_Abhisheks-MacBook-Pro.local_curve
ports:
- 5000:5000
volumes:
- data:/data
- /Users/as/.curve:/root/.curve
volumes:
data: {}
sqlite-serverCLI accepts--curvezmqboolean flag to enable encryptionsqlite-serverCLI accepts--key-idwhich is the server key id available at/root/.curvelocation/Users/as/.curve(on host machine) is mapped to/root/.curvein the docker container.
SQLite Database server with CurveZMQ encryption and ZAP authentication
ZeroMQ Authentication protocol
Setting --zap = True will restrict connections to clients whose public keys are in the /root/.curve/authorized_clients/ directory. Set this to False to allow any client with the server’s public key to connect, without requiring the server to possess each client’s public key.
version: "3"
services:
sqlite_server:
image: aosingh/sqlite_rx
command: sqlite-server --zap --curvezmq --log-level DEBUG --database /data/database.db --key-id id_server_Abhisheks-MacBook-Pro.local_curve
ports:
- 5000:5000
volumes:
- data:/data
- /Users/as/.curve:/root/.curve
volumes:
data: {}