Thanks to the point provided by @David Maze, the problem is this image use a default user sqlite
with user and group id as:
root@b8316:/home/guest/programfiles/docker# docker run --rm -it keinos/sqlite3 /bin/sh
/ $ id
uid=101(sqlite) gid=102(sqlite) groups=102(sqlite)
while the host mounted dir has user and group id 1000
, therefore, changing the user and group id of container user is the right way:
root@b8316:/home/guest/programfiles/docker# docker run --rm -it --user 1000:1000 -v "/home/guest/workspace:/workspace" -w /workspace keinos/sqlite3
SQLite version 3.47.2 2024-12-07 20:39:59
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open sample.db
sqlite> CREATE TABLE table_sample(timestamp TEXT, description TEXT);
sqlite> INSERT INTO table_sample VALUES(datetime('now'),'First sample data. Foo');
sqlite> INSERT INTO table_sample VALUES(datetime('now'),'Second sample data. Bar');
sqlite> .table
table_sample