A docker container for Neo4j is started as per the documentation and working properly using the following command:
$ docker run \
--detach \
--publish=7474:7474 \
--publish=7473:7473 \
--publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
--volume=$HOME/neo4j/ssl:/ssl \
--ulimit=nofile=40000:40000 \
--name=myname-neo4j \
neo4j:3.1.1
When I attempt to perform a neo4j-admin
dump of the database I get an error:
$ docker exec -ti myname-neo4j bin/neo4j-admin dump --database=graph.db --to=/home/name/myname.dump
command failed: the database is in use -- stop Neo4j and try again
However, if the Neo4j process is stopped, which seems to be the only way to free the database, the container closes. This appears to be the expected behavior from Docker. Therefore, it appears to be impossible to call neo4j-admin dump
from within the container without the database being in use.
How can this be resolved while still using Docker?
Best Answer
1: Stop the container.
2: Remove the container
3: Run the container as interactive mode (-it) without the option (detach) and executing the shell ( /bin/bash ).
Now you are inside the neo4j container without running Neo.
4: Check that neo is not up by visiting the URI endpoint in (http://yourhost:7474). You should see the "Unable to connect" message.
5: Dump your database