cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot edit neo4j.conf

I am installing Neo4j with Docker and I want to modify configuration in neo4j.conf file. However, after restarting container, the values is reset.
Anybody can help me?
1X_ba6dd420c7bbf7cad32c3d8bbd6036bbaf473d06.png

1 ACCEPTED SOLUTION

It's not possible to impact neo4j's configuration inside of the container without creating a new container. This is because inside of the neo4j docker container (right here: https://github.com/neo4j/docker-neo4j/blob/master/src/3.4/docker-entrypoint.sh#L216) -- the container process is just the neo4j binary.

Now, on linux systems, typically the neo4j binary is wrapped in a system service setup, like sysv, so you can do something like systemctl restart neo4j. This is not the case for the docker container, since it's considered good practice to have a container execute exactly one process. A discussion of why that's good docker practice can be found here.

The downside of this is that you can't change your config and restart the database. When this process finishes, your container exits, that's it.

So what are your options?

  1. Neo4j does have some dynamic configuration settings which can be adjusted by cypher code, with no neo4j.conf needed. If these fit for you, that's what I'd recommend.
  2. You can adjust your environment variables, kill the container, and restart. Note that if you manage volume mappings appropriately, you of course won't lose any data.

Unfortunately, editing configs without restarting the container won't work.

View solution in original post

4 REPLIES 4

Did you check the operations manual entry on docker? It's also linked in the intro message to this category.

There you have a section on passing config settings as env parameters.

From those the neo4j.conf is generated inside of the container at startup.

so you can pass any config setting from the outside, the only bit you have to remember is to double the underscore where the setting has an underscore

You also have an option to mount the conf directory but then you have to provide and maintain the full config in there.

Thanks for your help!
I used env parameters to create container, but now I want to try edit other configs without recreating container.
I also have tried to mount the conf directory but this folder is empty.
I used docker-compose to create container. Below is my docker-compose file:

version: '3'
services:
  local-env:
    image: neo4j:latest
    network_mode: "bridge"
    ports:
      - "7474:7474"
      - "7473:7473"
      - "7687:7687"
      - "2322:22"
    environment:
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*,algo.*
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_dbms_shell_enabled=true
      - NEO4J_dbms_memory_pagecache_size=4G
      - NEO4J_dbms_memory_heap_max__size=8G
      - NEO4J_dbms_memory_heap_initial__size=8G
      - NEO4J_dbms_tx__log_rotation_retention__policy=3G size
    volumes:
      - ./plugins:/plugins
      - ./data:/data
      - ./import:/import
      - ./conf:/conf

Thanks again for your help !

It's not possible to impact neo4j's configuration inside of the container without creating a new container. This is because inside of the neo4j docker container (right here: https://github.com/neo4j/docker-neo4j/blob/master/src/3.4/docker-entrypoint.sh#L216) -- the container process is just the neo4j binary.

Now, on linux systems, typically the neo4j binary is wrapped in a system service setup, like sysv, so you can do something like systemctl restart neo4j. This is not the case for the docker container, since it's considered good practice to have a container execute exactly one process. A discussion of why that's good docker practice can be found here.

The downside of this is that you can't change your config and restart the database. When this process finishes, your container exits, that's it.

So what are your options?

  1. Neo4j does have some dynamic configuration settings which can be adjusted by cypher code, with no neo4j.conf needed. If these fit for you, that's what I'd recommend.
  2. You can adjust your environment variables, kill the container, and restart. Note that if you manage volume mappings appropriately, you of course won't lose any data.

Unfortunately, editing configs without restarting the container won't work.

i have used a similar method you can make a docker folder create docker-compose.yml , volumes folder and use a copy of neo4j.conf file inside that folder and make changes inside that config file as per your need. You can copy that neo4j.conf file when you first make a docker image of neo4j into you local directory.