问题原文
原帖链接 · Gregyski · CC BY-SA 3.0
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?
已采纳解答
原帖链接 · Juan · CC BY-SA 3.0
1: Stop the container.
docker stop myname-neo4j
2: Remove the container
docker rm myname-neo4j
3: Run the container as interactive mode (-it) without the option (detach) and executing the shell ( /bin/bash ).
docker run \
--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 \
-it \
neo4j:3.1.1 \
-c /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
docker exec -ti myname-neo4j bin/neo4j-admin dump --database=graph.db --to=/home/name/myname.dump
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
