Reputation: 81
docker run -d -v /home/data:/data --name=neo neo4j
after I run a neo4j in docker,
docker exec -it neo bash
./neo4j-admin dump --database=graph.db --to=/home/2018.dump
it will say neo4j is running
command failed: the database is in use -- stop Neo4j and try again
but ./neo4j stop
will get neo4j not running
what should i do?
Upvotes: 6
Views: 1526
Reputation: 1398
I had the same issue before, so I wrote this workaround to dump neo4j data and pull it outside the container to the host machine.
docker rm --force neo4j-dump
docker run \
--name neo4j-dump \
--env-file /storage/bin/.neo4j.env \
--mount type=bind,source=<neo4j_data_folder>,target=/data \
neo4j bin/neo4j-admin dump --database=graph.db --to=/graph.db.dump
docker cp `docker ps -aqf "name=neo4j-dump"`:/graph.db.dump <target_dump_file>
docker rm --force neo4j-dump
This will create a new container and dump data instead of starting neo4j service, then copy the dump to the host, just update and to yours
Upvotes: 1