Docker unable to run neo4j (exited with code 4) - docker

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?

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 :
NEO4J_ACCEPT_LICENCE_AGREEMENT should be renamed to NEO4J_ACCEPT_LICENSE_AGREEMENT
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.

Related

Multiple database in docker compose

i am trying to create 2 database in a docker compose yml file, one is for the app and the other is for the test part, in the java spring framework i do use the the url like "jdbc:postgresql://localhost:5401/webTest", but id does not work.
From the cmd, i can connect to the database-user with no problem and the table are there but i can not connect to the database-test, is there a specific issue i am blind about?
#service
services:
database-user:
#container_name: postgres-user
image: postgres
ports:
- 5401:5432
volumes:
- postgres-user:/var/lib/postgresql/data
- ./scripts/create-table-db.sql:/docker-entrypoint-initdb.d/create-table-db.sql
environment:
- POSTGRES_USER=webAppUser
- POSTGRES_PASSWORD=user
- POSTGRES_DB=webApp
database-test:
#container_name: postgres-test
image: postgres
ports:
- 5402:5432
volumes:
- postgres-test:/var/lib/postgresql/data
- ./scripts/create-table-db.sql:/docker-entrypoint-initdb.d/create-table-db.sql
environment:
- POSTGRES_USER=webAppTest
- POSTGRES_PASSWORD=test
- POSTGRES_DB=webTest
volumes:
postgres-user:
postgres-test:
i did try to follow some example like here but its not clear.
(the database-user does work also in the java part)

Having permissions issues with Grafana 7.3.0 on Docker

I'm using docker-compose to create a Docker network of containers with InfluxDB, a python script and Grafana to harvest and visualize response codes, query times & other stats of different websites.
I am using Grafana image 7.3.0 with a volume,
I have modified the paths environment variables so I'll have to use only one volume to save all the data.
When I start the Grafana container it logs:
GF_PATHS_CONFIG='/etc/grafana/grafana.ini' is not readable.
GF_PATHS_DATA='/etc/grafana/data' is not writable.
GF_PATHS_HOME='/etc/grafana/home' is not readable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-
docker-container-to-5-1-or-later
mkdir: can't create directory '/etc/grafana/plugins': Permission denied
But here is the thing, I'm not migrating from below 5.1 I'm not even migrating at all!
So I tried to follow their instruction to change permissions of files but it did not worked.
I tried to set the user id in the docker-compose but it did not help.
(as-said in the docs 472 == post 5.1, 104 == pre 5.1 but both did not worked)
I can't even change permissions manually (which is not a satisfying solution btw) because the container is crashing.
I normally don't ask questions because they already have answers but I've seen no one with this trouble using 7.3.0 so I guess it's my time to shine Haha.
Here is my docker-compose.yml (only the grafana part)
version: '3.3'
services:
grafana:
image: grafana/grafana:7.3.0
ports:
- '3000:3000'
volumes:
- './grafana:/etc/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
environment:
- GF_PATHS_CONFIG=/etc/grafana/grafana.ini
- GF_PATHS_DATA=/etc/grafana/data
- GF_PATHS_HOME=/etc/grafana/home
- GF_PATHS_LOGS=/etc/grafana/logs
- GF_PATHS_PLUGINS=/etc/grafana/plugins
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
user: "472"
Thank you very much for your potential help!
Edit : I've been wondering if there is a grafana user in latest version (8.0), I think that build a home dir for grafana using a Dockerfile could be the solution I just need to find that user.
I'm here to close this subject.
So this was kind of a noob mistake but I could not have known.
The problem came from the fact that Grafana won't chown and chmod the volume folder. The error does not occures but it won't work because it does not save the data.
The solution was to remove the env variables and changing permissions of the local './grafana' folder wich contained the volume.
So I did
chown -R <personal local user> /path/to/local/volume/folder && \
chmod -R 777 /path/to/local/volume/folder
And now it works normally
Here is my new docker compose
docker-compose.yml
grafana:
image: grafana/grafana
ports:
- '3000:3000'
volumes:
- './grafana:/var/lib/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
Thanks everybody four your help !
Just replace your user's id that you will get on the following command:
$ id -u
Im running 'id -u' in my terminal and getting '1000'. SO, I replaced user: "xxxx" to user: "1000" in docker-compose.yml
version: '3.3'
services:
grafana:
image: grafana/grafana:7.3.0
ports:
- '3000:3000'
volumes:
- './grafana:/etc/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
environment:
- GF_PATHS_CONFIG=/etc/grafana/grafana.ini
- GF_PATHS_DATA=/etc/grafana/data
- GF_PATHS_HOME=/etc/grafana/home
- GF_PATHS_LOGS=/etc/grafana/logs
- GF_PATHS_PLUGINS=/etc/grafana/plugins
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
user: "1000"

How do I retain my content types within a dockerized strapi

I've been using strapi for docker (https://github.com/strapi/strapi-docker), but whenever I rebuild my container the data all disappears. I can still see it in the database, but the admin isn't recognizing it.
I tried recreating the content type, and then the records from the database appeared, but when I rebuild the container again the content type disappears
Where are content definitions stored? Is this a bug with the app? (I think strapi-docker is using an alpha release)
How to I get strapi to retain my content definitions in the database, so I can use a stateless container?
UPDATE
I tried looking at the attached volume -
api:
build: .
env_file: './dev.env'
ports:
- 1337:1337
volumes:
- ./strapi-app:/usr/src/api/strapi-app
#- /usr/src/api/strapi-app/node_modules
restart: always
But there's nothing in it -
Aidans-MacBook:strapi-docker aidan$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02b098286ada strapi-docker_api "docker-entrypoint.s…" 24 minutes ago Up 5 minutes (healthy) 0.0.0.0:1337->1337/tcp strapi-docker_api_1
Aidans-MacBook:strapi-docker aidan$ docker inspect -f "{{.Mounts}}" 02b098286ada
[{bind /Users/aidan/Documents/Code/beefbook/strapi-docker/strapi-app /usr/src/api/strapi-app rw true rprivate}]
Aidans-MacBook:strapi-docker aidan$ ls /Users/aidan/Documents/Code/beefbook/strapi-docker/strapi-app
Aidans-MacBook:strapi-docker aidan$
you need to mount the directory to keep the file persistent.
- ./strapi-app:/usr/src/api/strapi-app For application
- ./db:/data/db For DB
version: '3'
services:
api:
build: .
image: strapi/strapi
environment:
- APP_NAME=strapi-app
- DATABASE_CLIENT=mongo
- DATABASE_HOST=db
- DATABASE_PORT=27017
- DATABASE_NAME=strapi
- DATABASE_USERNAME=
- DATABASE_PASSWORD=
- DATABASE_SSL=false
- DATABASE_AUTHENTICATION_DATABASE=strapi
- HOST=localhost
ports:
- 1337:1337
volumes:
- ./strapi-app:/usr/src/api/strapi-app
#- /usr/src/api/strapi-app/node_modules
depends_on:
- db
restart: always
db:
image: mongo
environment:
- MONGO_INITDB_DATABASE=strapi
ports:
- 27017:27017
volumes:
- ./db:/data/db
restart: always
Run the docker-compose up and you will see the data is now has been persistent.
updated:
After investigation by #Aidan
it's used the APP_NAME env var (the default is "strapi-app"). so the correct mount is /usr/src/api/beef-content (since, in my case, the APP_NAME is beef-content). I'll use that to mount my volume
I may have a solution with my project "strapidocker-tools":
https://github.com/OliCpg/strapidocker-tools
This will let you backup, move and restore full dockerised strapi project.
Be aware that it will work with two docker containers named strapi and strapi_db. You should not rename them (i'll change that later on). They get recreated upon restore.
Still a work in progress and not very elegant at the present time but it works for me.
Feedback is welcome.

Downgrading elasticsearch in docker-compose.yml leads to license error

I have the following docker-compose.yml file:
...
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.3
container_name: elasticsearch-cust-comp
...
I've previously run it with another elasticsearch version:
...
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
container_name: elasticsearch-cust-comp
...
Since changing the version to 5.4.3, I'm getting this error in docker logs for the Elasticsearch container:
Unknown license version found, please upgrade all nodes to the latest elasticsearch-license plugin
My guess is that version 6.5.4 of Elasticsearch is still running somewhere and that it creates issues when I'm trying to run 5.4.3. But as far as I know, I've shut down all Elasticsearch containers currently running with docker-compose down, and docker ps shows no processes after this. Still, when I run docker-compose up -d with version 5.4.3, it gives me this error. Running 6.5.4 works fine. What do I need to do to be able to run version 5.4.3?
EDIT:
This is the whole part regarding elasticsearch in the docker-compose.yml. As you can see, xpack is already disabled:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.3
container_name: elasticsearch-cust-comp
ports:
- 9200:9200
- 9300:9300
volumes:
- cust-comp-elastic:/usr/share/elasticsearch/data
- ./cust/externalConfig/elasticsearch/config/hunspell/:/usr/share/elasticsearch/config/hunspell/
# - ./config/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
# - ./fwhome/elasticsearch/cust-comp:/usr/share/elasticsearch/config/cust-comp
networks:
- cust-comp
environment:
- cluster.name=i3-elasticsearch
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.ml.enabled=false
- xpack.graph.enabled=false
- xpack.watcher.enabled=false
restart: unless-stopped
In doubt, try:
docker system prune
This will clean unused containers/images.

docker-compose bolt address isn't working after upgrading neo4j to 3.5.3 from neo4j 3.4.10

I use docker-compose to set up several neo4j-containers with individual ports for each. With version 3.5.3 the
NEO4J_dbms_connector_bolt_advertised__address: ":12051"
does not work any more.
It worked with version 3.4.10 but does not with 3.5.3.
Any idea how to change this ?
Here a snippet from my docker-compose-file:
neo4jWikidataPersons:
image: neo4j:3.5.3
environment:
NEO4J_dbms_allow_upgrade: "true"
NEO4J_dbms_security_procedures_unrestricted: "apoc*,graph-algo*"
NEO4J_dbms_connector_bolt_advertised__address: "localhost:12051"
ports:
- "12050:7474"
- "12051:7687"
volumes:
- $HOME/docker/neo4j/wikidataPersons/data:/var/lib/neo4j/data
- $HOME/docker/neo4j/wikidataPersons/conf:/var/lib/neo4j/conf
- $HOME/docker/neo4j/plugins-3.5:/plugins
In the file you have to explicitly add the ip-address of the server in the line NEO4J_dbms_connector_bolt_advertised__address:
neo4jWikidataPersons:
image: neo4j:3.5.3
environment:
NEO4J_dbms_allow_upgrade: "true"
NEO4J_dbms_security_procedures_unrestricted: "apoc*,graph-algo*"
NEO4J_dbms_connector_bolt_advertised__address: "134.176.70.48:12051"
ports:
- "12050:7474"
- "12051:7687"
volumes:
- $HOME/docker/neo4j/wikidataPersons/data:/var/lib/neo4j/data
- $HOME/docker/neo4j/wikidataPersons/conf:/var/lib/neo4j/conf
- $HOME/docker/neo4j/plugins-3.5:/plugins

Resources