Communication between neo4j browser and container not working

Following these instructions: How-To: Run Neo4j in Docker - Developer Guides trying to connect after starting the browser on localhost:7474 results in:

neo4j-driver.chunkhash.bundle.js:1 WebSocket connection to 'ws://' failed: Error in connection establishment: net::ERR_ADDRESS_INVALID.

The workaround/solution posted here: Can't connect to DB using `latest` image: SessionExpired: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver · Issue #240 · neo4j/docker-neo4j · GitHub did not work for me.

I am running this container on Windows 10 using docker desktop

On that github issue -- specifically the part that fixes it is the modification of the advertised addresses. I think your connection is failing because is not a routable address from your desktop computer. You should instead advertise "localhost" as the address.

For follow-ups, please paste your exact run syntax, because details of docker port exposure also matter here. The principle here is that whatever your advertised address is, needs to be something that resolves properly from where your'e running your browser -- not from within the docker container itself.

Running this:
docker run -it --rm --publish=7474:7474 --publish=7687:7687
-e NEO4J_dbms_connector_https_advertised__address="localhost:7473" -e NEO4J_dbms_connector_http_advertised__address="localhost:7474"
-e NEO4J_dbms_connector_bolt_advertised__address="localhost:7687" --env=NEO4J_AUTH=none

works! I can connect. I would like to transfer this to docker-compose, but I am unblocked for now. Thanks, David.

1 Like