我正在尝试运行一个带有Neo4J镜像的docker容器。一切都很好,但我需要在容器初始化后添加约束。最好的方法是什么?
我使用cypher命令挂载了一个文件,并尝试使用docker-compose运行它,如下所示:
neo4j:
image: neo4j:3.5.8
container_name: neo4j
ports:
- "7474:7474"
- "7687:7687"
networks:
- backend
environment:
- NEO4J_dbms_security_procedures_unrestricted=apoc.*
- NEO4J_apoc_import_file_enabled=true
- NEO4J_dbms_shell_enabled=true
- NEO4J_AUTH=neo4j/password
volumes:
- .\lib\neo4j\plugins:/plugins
- .\src\main\resources:/scripts
- neo4j_data:/data
- neo4j_import:/neo4j_import
command: ["neo4j", "&&", "sleep 10", "&&", "cat /scripts/constraints.neo4j | cypher-shell -u neo4j -p password"]我甚至试过了
entrypoint: ""
command: "/docker-entrypoint.sh neo4j && sleep 10 && cat /scripts/constraints.neo4j | cypher-shell -u neo4j -p password"但是约束并没有被制造出来。如何从文件中传递我的密码命令?谢谢。
发布于 2019-10-11 19:21:05
要做到这一点,最简单的方法是使用APOC及其初始化器特性:https://neo4j.com/docs/labs/apoc/current/operational/init-script/#init-script
https://stackoverflow.com/questions/58336934
复制相似问题