Search code examples
questdb

How do I persist data in a QuestDB docker container?


I'm running QuestDB from the Docker image but when I stop it, the data is not persisted on restart:

docker run -p 9000:9000 -p 8812:8812 questdb/questdb

What's a good strategy for keeping the tables / records when restarting this?


Solution

  • You can do this in a few ways, a convenient way is to give the container a name when you start it first:

    docker run -p 9000:9000 -p 8812:8812 --name questdb-example questdb/questdb
    

    When this image is stopped, you can bring it up again with the data persisted:

    # bring the container up
    docker start questdb-example
    # shut the container down
    docker stop questdb-example