Other database dockers that I've worked with (like Postgres) have a mechanism to import some initial data into their empty instance once the container starts for the first time. This is usually in form of putting your SQL files in a specific folder.
I need to do the same for Neo4j. I want to compose a Neo4j docker image with some data in it. What's the right way to do this?
This could be achieved... There are 2 requirements:
bin/neo4j-admin set-initial-password <password>
and thencat import/data.cypher | NEO4J_USERNAME=neo4j NEO4J_PASSWORD=${NEO4J_PASSWD} bin/cypher-shell --fail-fast
Sample
Dockerfile
may look like thisBuilding image
sudo docker build -t neo4j-3.1:loaddata .
And running container
docker run -it --rm --name neo4jtest neo4j-3.1:loaddata