pinale
pinale

Reputation: 2214

run neo4j with docker-compose - neo4j not accessible from localhost:7474

---EDITED -- NO LONGER WORKING --- PLEASE HELP--- maybe something is changed in the latest neo4j image (SE MY ANSWER BELOW FOR MORE DETAILS)

I'm try to run neo4j with docker-compose by means of this github repo (that contains the docker-compose.yml)

https://github.com/GraphRM/workshop-neo4j-docker

The docker-compose file conteined in this repo is nothing more that a plain neo4j docker image with some data already attached (you can try yourself, the image is realy small)

Running this file docker-compose up -d (from the folder where the docker-compose.yml file is) seems that all gone well (No errors are showed and the output of the console is Starting workshopneo4jdocker_neo4j_1 ... done) but in the browser nothing is showed at the following addresses:

localhost:7474
0.0.0.0:7474
127.0.0.1:7474
<dockermachine ip>:7474    got this address with `docker-machine ip`

I suppose is it a network problem (wrong ip address or something related) so i've noted that in the docker-compose.yml file is missing the element network_mode:

docker-compose.yml

version: '3'

services:
  neo4j:
    image: neo4j:latest
    ports:
      - "7474:7474"
      - "7687:7687"
    environment:
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_dbms_shell_enabled=true
    volumes:
      - ./plugins:/plugins
      - ./data:/data
      - ./import:/import

I'd like to modify this file adding network_mode: "bridge" or test with other values (host,none,service:[service name],container:[container name/id])

but the question now is:

how to modify this file if the nano editor is not installed in the neo4j docker image and i can't even install it because apt-get is not installed as well. (it is a really very minimal image)

Morovere i'm not a linux user so i don't know how to modyfy this file. May you suggest me the way to modify this file on an image that does't have these tools without using vim?

I'm not so expert with linux but i need to run this docker-compose.yml file provided with the above github repo.

MY ENVIROMENT

Docker Toobox for windows
`docker version`
Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f51b1
 Built: Thu Jan 11 22:29:41 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:13:12 2018
  OS/Arch:      linux/amd64
  Experimental: false

PS: do you think the problem is not related to the ip address?

>>>>>EDITED<<<<<

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
38e06d1020d8        neo4j:latest        "/docker-entrypoint.…"   30 hours ago        Up 29 minutes       0.0.0.0:7474->7474/tcp, 7473/tcp, 0.0.0.0:7687->7687/tcp   workshopneo4jdocker_neo4j_1

Upvotes: 4

Views: 8324

Answers (2)

Ashish Sharma
Ashish Sharma

Reputation: 672

Below yml file work fine to me. Yes it is not very fast and you have to wait for 2-3 minutes for it to come up and available to browser at http://localhost:7474/browser

version: '3'


services:
  neo4j:
    image: neo4j:4.3.3-community #4.3.3-community  latest
    container_name: neo4j
    ports:
      - "7474:7474"
      - "7687:7687"
    networks:
      - ecosystem_network
    environment:
      - NEO4J_AUTH=neo4j/eco_system
      - NEO4J_dbms_memory_pagecache_size=512M
    volumes:
      - ${HOME}/neo4j/data:/data 
      - ${HOME}/neo4j/logs:/logs 
      - ${HOME}/neo4j/import:/var/lib/neo4j/import 
      - ${HOME}/neo4j/plugins:/plugins 

    

networks:
  ecosystem_network:
    driver: bridge

Upvotes: 1

pinale
pinale

Reputation: 2214

Adding network_mode: "bridge" to the docker-compose.yml file and accessing to the docker-machine ip the image works correctly

docker-compose.yml

version: '3'

services:
  neo4j:
    image: neo4j:latest
    network_mode: "bridge"
    ports:
      - "7474:7474"
      - "7687:7687"
    environment:
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_dbms_shell_enabled=true
    volumes:
      - ./plugins:/plugins
      - ./data:/data
      - ./import:/import

Upvotes: 9

Related Questions