neo4j / docker-neo4j

Docker Images for the Neo4j Graph Database
Apache License 2.0
318 stars 168 forks source link

Docker bind only 192.168.58.110 address and not all interfaces #485

Closed jmcgroup3 closed 4 months ago

jmcgroup3 commented 4 months ago

I can't get my neo4j docker-compose to only serve from 192.168.58.110

It binds on every interface 0.0.0.0 and I can access it via localhost:7474 which I don't want I want to isolate it.

// Both of these work but I only want the first one to be valid
const driver = neo4j.driver('neo4j://192.168.58.110', neo4j.auth.basic('neo4j', 'password'))
const driver = neo4j.driver('neo4j://localhost', neo4j.auth.basic('neo4j', 'password'))

I don't know if this is possible or I just have to accept that it binds localhost everything and nothing I can do.

services:
  graph:
    image: neo4j
    container_name: graph1
    ports:
      - "127.0.0.1:7474:7474"
      - "127.0.0.1:7687:7687"
    volumes:
      - ./data:/data
    environment:
      - NEO4J_AUTH=neo4j/password
    networks:
      mynetwork:
        ipv4_address: 192.168.58.110

networks:
  mynetwork:
    ipam:
      config:
        - subnet: 192.168.58.0/24
jmcgroup3 commented 4 months ago

I fixed my issue by changing ports to expose:

services:
  graph:
    image: neo4j
    container_name: graph1
    expose:
      - "7474"
      - "7687"
    volumes:
      - ./data:/data
    environment:
      - NEO4J_AUTH=neo4j/password
    networks:
      mynetwork:
        ipv4_address: 192.168.58.110