Docker unable to run neo4j (exited with code 4)

481 views Asked by At

I am running neo4j on docker (windows 11), using the following:

version: '3.3'
services:
  neo4j:
    image: neo4j:latest
    container_name: "cmkg-neo4j-db"
    restart: always
    volumes:
      - $HOME/neo4j/data:/data
      - $HOME/neo4j/import:/var/lib/neo4j/import
      - ./db/neo4j-cyphers:/import
      - $HOME/neo4j/plugins:/plugins
      - $HOME/neo4j/logs:/logs
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_ACCEPT_LICENCE_AGREEMENT=yes
      - NEO4J_AUTH=neo4j/root
      - NEO4J_dbms_default__listen__address=0.0.0.0
      - NEO4J_dbms_default__advertised__address=localhost
      - NEO4J_dbms_connector_bolt_enabled=true
      - NEO4J_dbms_routing_enabled=true
      - NEO4J_dbms_connector_bolt_listen__address=:7687
      - NEO4J_dbms_connector_bolt_advertised__address=:7687
      - NEO4J_dbms_logs_debug_level=DEBUG
      - NEO4J_apoc_import_file_use__neo4j__config=true
      - NEO4J_apoc_initializer_cypher=CALL apoc.cypher.runSchemaFile('file:///init_db_setup.cypher')
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
      - NEO4JLABS_PLUGINS=["apoc", "n10s"]
    networks:
      - cmkg_net

  api:
    container_name: "cmkg-container"
    restart: always
    build:
      context: .
    ports:
      - 5000:5000
    environment:
      - NEO4J_URI=bolt://neo4j:7687
      - NEO4J_USER=neo4j
      - NEO4J_PW=root
    volumes:
      - .:/app
    links:
      - 'neo4j'
    depends_on:
      - 'neo4j'
    networks:
      - cmkg_net

networks:
  cmkg_net:
    driver: bridge

It was working properly for a while, but after pulling a new branch, it gave me the following error (shown also in the image): Docker-neo4j issue

cmkg-neo4j-db exited with code 4
cmkg-neo4j-db   | NEO4JLABS_PLUGINS has been renamed to NEO4J_PLUGINS since Neo4j 5.0.0.
cmkg-neo4j-db   | The old name will still work, but is likely to be deprecated in future releases.
cmkg-neo4j-db   | Installing Plugin 'apoc' from /var/lib/neo4j/labs/apoc-*-core.jar to /plugicmkg-neo4j-db   | Applying default values for plugin apoc to neo4j.conf
cmkg-neo4j-db   | Skipping dbms.security.procedures.unrestricted for plugin apoc because it is already set.cmkg-neo4j-db   | You may need to add apoc.* to the dbms.security.procedures.unrestricted setting in your configuration file.cmkg-neo4j-db   | Fetching versions.json for Plugin 'n10s' from https://neo4j-labs.github.io/neosemantics/versions.jsoncmkg-neo4j-db   | Installing Plugin 'n10s' from null to /plugins/n10s.jar
cmkg-neo4j-db exited with code 4

Trying the previous branch got the same error.

So far, I tried to remove then re-install docker & neo4j but still!

Any idea what could cause this issue, and how can I make it run again?

1

There are 1 answers

2
Christophe Willemsen On

Using latest takes the latest Neo4j release and it's really not recommended to use such tag.

The working behaviour is probably with Neo4j 4, but now Neo4j 5 is out and APOC changed as well.

Couple of things with your docker compose :

  1. NEO4J_ACCEPT_LICENCE_AGREEMENT should be renamed to NEO4J_ACCEPT_LICENSE_AGREEMENT

  2. The following settings are not valid anymore

- NEO4J_apoc_import_file_use__neo4j__config=true
- NEO4J_apoc_initializer_cypher=CALL apoc.cypher.runSchemaFile('file:///init_db_setup.cypher')
- NEO4J_apoc_import_file_enabled=true

Take a look at installing APOC Extended here https://neo4j.com/labs/apoc/5/installation/


In case you want to remain on latest 4.4, you can just use the 4.4-enterprise tag which is automatically updated to the latest 4.4 version.