Setting of NEO4J_AUTH does not work in

Hi,
I want to run the neo4j container with initialized data on Amazon ECS. So I extend the neo4j docker image, setup and run the data import and then run the original entry point. The problem is that the neo4j user keeps its default password (neo4j) and its setting using NEO4J_AUTH env var does not work.

My Dockerfile looks like this:

FROM neo4j
ENV NEO4J_AUTH=neo4j/graphPass
ENV JAVA_OPTS='-server -Xms2g -Xmx2g'

RUN curl -sL https://deb.nodesource.com/setup_13.x | bash -
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt -y update && \
  apt -y upgrade && \
  apt-get install -y nodejs yarn tar

WORKDIR /code

COPY ./ /code

RUN chown -R neo4j:neo4j /code

RUN yarn install
RUN ./node_modules/.bin/webpack --config ./webpack.config.js

And the container is run with command from this bash script: (The node.js script basically downloads the data and imports them by calling neo4j-admin import.)

#!/bin/bash

node ./dist/init-data.js
/sbin/tini -gs -- /docker-entrypoint.sh neo4j

I can't run change the password by running cypher-shell -u neo4j -p neo4j "CALL dbms.security.changePassword('graphPass');" in the script because the neo4j server isn't started yet so I'm quite clueless.

Hi @JakubMatejka,

RUN ./node_modules/.bin/webpack --config ./webpack.config.js

If I good understand you want run this script in background?
Maybe try using ENTRYPOINT? but first check process on your container and sure that working, if working, next check docker logs and put there.

Please also put error after:

cypher-shell -u neo4j -p neo4j "CALL dbms.security.changePassword('graphPass');"

Hi Maciej,
I've managed to change the password by calling

/var/lib/neo4j/bin/neo4j-admin set-initial-password "graphPass"

in the bash script, so it is working fine now.

Thanks.
Jakub

1 Like