Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-29-2018 02:54 AM
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?
Solved! Go to Solution.
08-29-2018 04:50 AM
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?
Unfortunately, editing configs without restarting the container won't work.
08-29-2018 03:01 AM
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.
08-29-2018 03:58 AM
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 !
08-29-2018 04:50 AM
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?
Unfortunately, editing configs without restarting the container won't work.
09-18-2022 11:12 PM
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.
All the sessions of the conference are now available online