运行EXTENSION_SCRIPT后,Neo4J Docker容器无法启动

时间:2018-04-05 18:06:17

标签: docker neo4j

我正在使用docker-compose从官方图片创建一个neo4j服务,其中包含以下Dockerfile:

FROM neo4j:3.3.4

ADD zz-docker/neo4j/neo4j-init.sh /scripts/

EXPOSE 7474
EXPOSE 7687

和docker-compose.yml

neo4j:
   environment:
     - EXTENSION_SCRIPT=/scripts/neo4j-init.sh
   build:
     context: ../
     dockerfile: zz-docker/neo4j/Dockerfile
   image: zz-neo4j
   container_name: zz-neo4j-01
   ports:
     - 7474:7474
     - 7687:7687
   networks:
     - zz-net
   volumes:
     - ../neo4j-data:/data
     - ../neo4j-logs:/logs

networks:
  zz-net:
    driver: bridge

扩展脚本用于根据帖子create-neo4j-database-from-backup-inside-neo4j-docker在容器启动时预加载数据库转储,如下所示:

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# do not run init script at each container start but only at the first start
if [ ! -f /var/lib/neo4j/data/neo4j-import-done.flag ]; then
    echo "Importing neo4j-init.dump ..."
    /var/lib/neo4j/bin/neo4j-admin load --from=/var/lib/neo4j/data/neo4j-init.dump --database=graph.db --force=true
    touch /var/lib/neo4j/data/neo4j-import-done.flag
    echo "Import complete"
else
    echo "There is no neo4j-init.dump file or the neo4j import has already run."
fi

但是,导入完成后,容器无法开始报告错误:

/docker-entrypoint.sh: line 218: exec su-exec neo4j: command not found

如果没有定义EXTENSION_SCRIPT,容器启动时没有问题(虽然没有运行导入脚本)。

感激不尽的任何建议!

0 个答案:

没有答案