2015-02-07 140 views
4

在OSX上使用docker运行spark-notebook(通过boot2docker)似乎没有任何作用。下面是输出如何在MacOS X上的docker上运行spark-notebook?

[email protected]:~/apps/spark-notebook$ docker run -p 9000:9000 andypetrella/spark-notebook:0.1.4-spark-1.2.0-hadoop-1.0.4 
Play server process ID is 1 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/opt/docker/lib/spark-repl_2.10-1.2.0-notebook.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/opt/docker/lib/ch.qos.logback.logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/opt/docker/lib/org.slf4j.slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 
15/02/07 11:51:32 INFO play: Application started (Prod) 
15/02/07 11:51:32 INFO play: Listening for HTTP on /0:0:0:0:0:0:0:0:9000 

当我在http://localhost:9000点我的浏览器,它说该网页无法使用。我错过了什么吗?配置有误吗?

回答

7

使用运行火花笔记本boot2docker需要一个额外的命令才能工作。

其实Docker中的端口转发是不够的,必须在虚拟机级别完成,以使其能够访问主机(localhost/127.0.0.1)。

这里是需要额外的命令: VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port9000,tcp,,9000,,9000"

@see this question了解更多详情。

0

使用运行IPython的笔记本电脑下面的命令

ipython notebook --no-browser --profile=pyspark --ip=*

然后尝试

open http://$(boot2docker ip):8888 

欲了解更多详情,请参阅this post

0

在您收到以下错误事件:

➜ VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port9000,tcp,,9000,,9000" VBoxManage: error: The machine 'boot2docker-vm' is already locked for a session (or being unlocked) VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 471 of file VBoxManageModifyVM.cpp

您可以通过停止VM,将你的变化,并重新开始boot2docker解决它......

1)boot2docker stop

2)VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port9000,tcp,,9000,,9000"

3)boot2docker start