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

半城伤御伤魂 提交于 2019-12-23 20:18:40

问题


---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

回答1:


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


来源:https://stackoverflow.com/questions/48465046/run-neo4j-with-docker-compose-neo4j-not-accessible-from-localhost7474

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!