Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed sqlite database to docker container?

Tags:

docker

I'm new to Docker. Is it possible to embed a sqlite database in a docker container and have it updated every time my script in that container runs?

like image 902
Pinch Avatar asked Nov 14 '15 18:11

Pinch


People also ask

Can you put a database in a Docker container?

You can use Docker to run a database in a container as if it were a remote server, and test how your application interacts with it. This tutorial describes how to run a Docker container with a PostgreSQL server and connect to it using IntelliJ IDEA.

Should I put database in Docker?

Docker is great for running databases in a development environment! You can even use it for databases of small, non-critical projects which run on a single server. Just make sure to have regular backups (as you should in any case), and you'll be fine.

Can SQLite be deployed?

SQLite is the most widely deployed database in the world with more applications than we can count, including several high-profile projects. SQLite is a compact library. With all features enabled, the library size can be less than 750KiB, depending on the target platform and compiler optimization settings.

How do I create a Docker image for a database?

Learn to set up and run Docker containers for databasesCreate a Docker Compose YAML file for a MySQL Docker container. Connect to the MySQL database, running on a container, using various methods. Create and run multiple versions of MySQL in Docker containers.


1 Answers

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/

like image 196
sramu Avatar answered Oct 17 '22 13:10

sramu