非常简单:
christian@christian:~/development$ docker -v
Docker version 1.6.2, build 7c8fca2
我跑these instructions启动了泊坞广告。
docker run --detach --name neo4j --publish 7474:7474 \
--volume $HOME/neo4j/data:/data neo4j
这里没有什么令人兴奋的;这应该只是工作。 但是,http://localhost:7474没有回应。当我跳进容器时,似乎响应得很好(参见调试会话)。我错过了什么?
christian@christian:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d9e0d5d2f73 neo4j:latest "/docker-entrypoint. 15 minutes ago Up 15 minutes 7473/tcp, 0.0.0.0:7474->7474/tcp neo4j
christian@christian:~$ curl http://localhost:7474
^C
christian@christian:~$ time curl http://localhost:7474
^C
real 0m33.353s
user 0m0.008s
sys 0m0.000s
christian@christian:~$ docker exec -it 2d9e0d5d2f7389ed8b7c91d923af4a664471a93f805deb491b20fe14d389a3d2 /bin/bash
root@2d9e0d5d2f73:/var/lib/neo4j# curl http://localhost:7474
{
"management" : "http://localhost:7474/db/manage/",
"data" : "http://localhost:7474/db/data/"
}root@2d9e0d5d2f73:/var/lib/neo4j# exit
christian@christian:~$ docker logs 2d9e0d5d2f7389ed8b7c91d923af4a664471a93f805deb491b20fe14d389a3d2
Starting Neo4j Server console-mode...
/var/lib/neo4j/data/log was missing, recreating...
2016-03-07 17:37:22.878+0000 INFO No SSL certificate found, generating a self-signed certificate..
2016-03-07 17:37:25.276+0000 INFO Successfully started database
2016-03-07 17:37:25.302+0000 INFO Starting HTTP on port 7474 (4 threads available)
2016-03-07 17:37:25.462+0000 INFO Enabling HTTPS on port 7473
2016-03-07 17:37:25.531+0000 INFO Mounting static content at /webadmin
2016-03-07 17:37:25.579+0000 INFO Mounting static content at /browser
2016-03-07 17:37:26.384+0000 INFO Remote interface ready and available at http://0.0.0.0:7474/
答案 0 :(得分:1)
我无法重现这一点。 Docker 1.8.2。 &安培; 1.10.0对你的情况没问题:
docker run --detach --name neo4j --publish 7474:7474 neo4j
curl -i 127.0.0.1:7474
HTTP/1.1 200 OK
Date: Tue, 08 Mar 2016 16:45:46 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 100
Server: Jetty(9.2.4.v20141103)
{
"management" : "http://127.0.0.1:7474/db/manage/",
"data" : "http://127.0.0.1:7474/db/data/"
}
尝试升级Docker并检查netfilter规则以进行转发。
答案 1 :(得分:0)
不是向localhost
发出请求,而是要使用docker-machine VM ip地址,您可以使用此命令确定该地址:
docker-machine inspect default | grep IPAddress
或
curl -i http://$(docker-machine ip default):7474/
默认IP地址为192.168.99.100
答案 2 :(得分:0)
好的,基本上我将args中的卷装置移除到了docker并且它可以工作。最终,我不想要一个容器外的装载。感谢@LoadAverage让我感到困惑。它仍然没有“正确”#39;但就我的目的而言,我并不在乎。
christian@christian:~/development$ docker run --detach --name neo4j --publish 7474:7474 neo4j
6c94527816057f8ca1e325c8f9fa7b441b4a5d26682f72d42ad17614d9251170
christian@christian:~/development$ curl http://127.0.0.1:7474
{
"management" : "http://127.0.0.1:7474/db/manage/",
"data" : "http://127.0.0.1:7474/db/data/"
}
christian@christian:~/development$