使用docker-compose运行neo4j-从本地主机无法访问neo4j:7474 [英] run neo4j with docker-compose - neo4j not accessible from localhost:7474

查看:998
本文介绍了使用docker-compose运行neo4j-从本地主机无法访问neo4j:7474的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

---编辑-不再工作---请帮助--- 也许最新的neo4j映像有所更改(有关更多详细信息,请参见我的答案)

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

我试图通过此github存储库(包含docker-compose.yml)在docker-compose上运行neo4j

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

此存储库中包含的docker-compose文件无非是一个普通的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)

运行此文件docker-compose up -d(从docker-compose.yml文件所在的文件夹)似乎一切正常(未显示任何错误,并且控制台的输出为Starting workshopneo4jdocker_neo4j_1 ... done) 但在浏览器中,以下地址未显示任何内容:

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`

我想这是网络问题(错误的IP地址或相关的东西),所以我注意到docker-compose.yml文件中缺少元素network_mode:

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

我想添加network_mode: "bridge"来修改此文件或使用其他值(host,none,service:[service name],container:[container name/id])进行测试

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

但现在的问题是:

如果neo4j docker映像中未安装nano编辑器,并且我什至无法安装它,因为还没有安装apt-get,则如何修改此文件. (这是非常小的图像)

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我不是Linux用户,所以我不知道如何修改该文件. 您是否可以建议我在不使用vim 的没有这些工具的图像上修改此文件的方法?

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?

我不是Linux专家,但是我需要运行上述github存储库提供的docker-compose.yml文件.

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

我的环境

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:您认为问题与IP地址无关吗?

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

推荐答案

docker-compose.yml文件中添加network_mode: "bridge"并访问docker-machine ip,镜像可以正常工作

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

这篇关于使用docker-compose运行neo4j-从本地主机无法访问neo4j:7474的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆