Martin
Martin

Reputation: 1947

Configuring Neo4j and preserving data inside a Docker container

I have a Neo4j instance running inside a Docker container. Would it be considered a good practice to change default password and create new user? If so, should this be configured once and persisted or configured each time the image is upgraded?

How to preserve data itself? Should I backup and restore each time the image is upgraded or is it sufficient to store database data in a volume? Wouldn't the second option delete the data when I upgrade the image?

Upvotes: 0

Views: 556

Answers (1)

Muldec
Muldec

Reputation: 4921

It's always a good practice to change default passwords. Neo4j does not make an exception to that.

The docker image of Neo4j exposes two volumes, one of wich is the data volume so you can persist the data outside of the container. To do that, you must use the --volume=$HOME/neo4j/data:/data argument in your docker run command. These data won't be deleted if you upgrade the image as they will be preserved outside of it.

If I remember correctly, the user info are store in a dbms folder inside data/. Persisting data through the volume would then also persist users, meaning you won't have to set passwords or create user each time the container starts.

Upvotes: 2

Related Questions