无法在docker neo4j中安装apoc

62lalag4  于 2023-04-29  发布在  Docker
关注(0)|答案(1)|浏览(363)

我已经在生产和开发环境中运行了neo4j示例。它使用Docker托管在VM上。现在我想用apoc。
我写了这个Dockerfile。

FROM neo4j:5.1.0-community

ENV APOC_VERSION=5.1.0

ENV apoc.export.file.enabled=true
ENV apoc.import.file.enabled=true
ENV apoc.import.file.use_neo4j_config=true

ADD https://github.com/neo4j/apoc/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-core.jar /plugins/

从文件上看,这似乎很好。然而,当我试图打开它时,我得到了这个错误:

2023-04-26 18:54:34.915+0000 INFO  Starting...
2023-04-26 18:54:35.881+0000 INFO  This instance is ServerId{ac8140db} (ac8140db-4060-498a-818d-b7beaa3b826e)
2023-04-26 18:54:37.464+0000 INFO  ======== Neo4j 5.1.0 ========
2023-04-26 18:54:41.802+0000 ERROR Failed to start Neo4j on 0.0.0.0:7474.
java.lang.RuntimeException: Error starting Neo4j database server at /data/databases
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:255) ~[neo4j-5.1.0.jar:5.1.0]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:193) ~[neo4j-5.1.0.jar:5.1.0]
        at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36) ~[neo4j-5.1.0.jar:5.1.0]
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:164) ~[neo4j-5.1.0.jar:5.1.0]
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:85) ~[neo4j-5.1.0.jar:5.1.0]
        at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:30) ~[neo4j-5.1.0.jar:5.1.0]
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.procedure.impl.GlobalProceduresRegistry@31db34da' was successfully initialized, but failed to start. Please see the attached cause exception "Some jar procedure files (apoc-5.1.0-core.jar) are invalid, see log for details.".
        at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:370) ~[neo4j-common-5.1.0.jar:5.1.0]
        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:92) ~[neo4j-common-5.1.0.jar:5.1.0]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:246) ~[neo4j-5.1.0.jar:5.1.0]
        ... 5 more
Caused by: java.util.zip.ZipException: Some jar procedure files (apoc-5.1.0-core.jar) are invalid, see log for details.
        at org.neo4j.procedure.impl.ProcedureJarLoader.loadProceduresFromDir(ProcedureJarLoader.java:74) ~[neo4j-procedure-5.1.0.jar:5.1.0]
        at org.neo4j.procedure.impl.GlobalProceduresRegistry.start(GlobalProceduresRegistry.java:338) ~[neo4j-procedure-5.1.0.jar:5.1.0]
        at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:353) ~[neo4j-common-5.1.0.jar:5.1.0]
        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:92) ~[neo4j-common-5.1.0.jar:5.1.0]
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:246) ~[neo4j-5.1.0.jar:5.1.0]
        ... 5 more
2023-04-26 18:54:41.805+0000 INFO  Neo4j Server shutdown initiated by request
2023-04-26 18:54:41.806+0000 INFO  Stopped.
gywdnpxw

gywdnpxw1#

我找到解决办法了!权限有问题。在文档中,它指出从您的主机装载此文件。默认情况下,它为您提供以下权限:

-rw-r--r-- 1 1000 1000

hovewer添加文件时,权限为:

-rw------- 1 root root

所以你需要做的一切。就是加上:

RUN chmod a+r /plugins/apoc-${APOC_VERSION}-core.jar

在你档案的最后

相关问题