2

I want to setup my neo4j database and my .NetCore Web Api with Docker. I created the following docker-compose file :

version: '3.4'

services:
  server:
    image: ${DOCKER_REGISTRY-}server
    network_mode: "bridge"
    build:
      context: .
      dockerfile: Server/Dockerfile
    stdin_open: true
    tty: true
    environment:
      - CHOKIDAR_USEPOLLING=true
    depends_on:
      - neo4j
  neo4j:
    image: "neo4j:latest"
    network_mode: "bridge"
    ports:
      - "7474:7474"
      - "7687:7687"
    volumes:
      - $HOME/neo4j/data:/data
      - $HOME/neo4j/logs:/logs
      - $HOME/neo4j/import:/var/lib/neo4j/import
      - $HOME/neo4j/plugins:/plugins
    environment:
      - NEO4J_AUTH=neo4j/admin

Within my .NetCore Server I check whether I can reach the neo4j address (172.17.0.3:7474), which works. Connecting to the Neo4J Database does not work with the following code :

_client = new GraphClient(new Uri("http://172.17.0.3:7474/db/data/"), "neo4j", "admin");
_client.Connect();

The error message is :

System.Exception: 'Received an unexpected HTTP status when executing the request.

The response status was: 404 Not Found
TobiasW
  • 861
  • 3
  • 13
  • 36
  • 1. Do you need to specify bridge as network mode? The default network driver is bridge. If you don't specify a driver,this is type of network you are creating. 2. Docker's builtin DNS resolves IP addresses from container/service names, try to just use the service name. – abestrad Jun 22 '20 at 14:06
  • @abestrad 1. I know that, I just forced it to be 100% sure that bridge is the current network type, I guess it has no further side effects, so I could just keep it right? 2. Could you explain that a bit more in detail, I just researched it, but can't find a proper example, can I just replace the ip address with the service like so? : `_client = new GraphClient(new Uri("http://neo4j:7474/db/data/"), "neo4j", "admin");` – TobiasW Jun 23 '20 at 05:20
  • Have same problem. But locally, not in Docker if i try in browser. But trying with curl, it returns 302. I think it may caused by Enterprise Edition of Neo4j, but i\m not sure. – Vlad Jun 29 '20 at 07:44

1 Answers1

1

The library doesn't fully support Neo4j 4.x yet -still in development-.

You can either use an older image of Neo4j (using Neo4j:3.5.19 connects successfully), or you can use a different driver.

rhytonix
  • 968
  • 6
  • 14