Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j + Docker - unable to create JVM

I'm trying to build a docker container for a Neo4j DB. While running the db locally isn't an issue, the container is having issues starting the JVM. Looking through the neo4j:3.2.2 image I'm building my own Dockerfile from I can't see us using different versions of the JRE. The issue seems to stem from they neo4j.conf, where It crashes on unrecognized VM option flags, such as UseG1GC and OmitStackTraceInFastThrow

The Dockerfile is fairly short

FROM neo4j:3.2.2
ADD ./neo4j.conf /var/lib/neo4j/conf/.
ADD ./data/. /var/lib/neo4j/import
ADD ./scripts/. .

I've also got a docker-compose.yml

version: '2'
 services:
  neo4j:
    image: eu.gcr.io/tine-matsans-v2/neo4j:develop
    container_name: neo4j
    build:
      context: ./neo4j/.
    ports:
      - "7474:7474"
      - "7473:7473"
      - "7687:7687"
    environment:
      - NEO4J_USERNAME=neo4j
      - NEO4J_PASSWORD=litago

I'm on a Windows 10 machine, but the image builds a unix container. My colleague has no issues whatsoever with running the container, using the same configs, though he's using a Mac. That should not be relevant as the issue is within the container.

neo4j            | Active database: graph.db
neo4j            | Directories in use:
neo4j            |   home:         /var/lib/neo4j
neo4j            |   config:       /var/lib/neo4j/conf     
neo4j            |   logs:         /var/lib/neo4j/logs
neo4j            |   plugins:      /var/lib/neo4j/plugins
neo4j            |   import:       /var/lib/neo4j/import
neo4j            |   data:         /var/lib/neo4j/data
neo4j            |   certificates: /var/lib/neo4j/certificates
neo4j            |   run:          /var/lib/neo4j/run
neo4j            | Starting Neo4j.
neo4j            | Unrecognized VM option 'UseG1GC
neo4j            | Did you mean '(+/-)UseG1GC'?
neo4j            | Error: Could not create the Java Virtual Machine.
neo4j            | Error: A fatal exception has occurred. Program will exit.

Has anyone run into similar issues? I've searched through several stack overflow posts as well as tried to read up on how the JVM and Containers work, but I can't find any solid information to help me sort this out.

like image 291
Iltharion Avatar asked Dec 24 '22 16:12

Iltharion


2 Answers

I ran into this same issue. Turned out to be a the line endings on the neo4j.conf file. I used the VS code to switch the line endings to 'LF' and ran docker-compose up and everything worked out. Hope this helps.

Visual Studio Code: How to show line endings

like image 75
youngaj Avatar answered Dec 28 '22 11:12

youngaj


Had to stop the docker-machine, go to the conf file, using notepadd++ convert file to UTF8 even if it's already utf8, edit eof to unix, save, docker-machine start, docker-compose up yey works

like image 34
user7673492 Avatar answered Dec 28 '22 09:12

user7673492