Embed sqlite database to docker container?

If you want to persist the data in sqlite, use host directory/file as a data volume Refer "Mount a host directory as a data volume" section in https://docs.docker.com/storage/volumes/


Dockerfile example to install sqlite3

FROM ubuntu:trusty
RUN sudo apt-get -y update
RUN sudo apt-get -y upgrade
RUN sudo apt-get install -y sqlite3 libsqlite3-dev
RUN mkdir /db
RUN /usr/bin/sqlite3 /db/test.db
CMD /bin/bash

persist the db file inside host OS folder /home/dbfolder

docker run -it -v /home/dbfolder/:/db imagename

Tags:

Docker