Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

python - 在Docker上的Anaconda下运行jupyter笔记本(Running jupyter notebook under Anaconda on Docker)

I am following the instructions give here to run a Jupyter notebook under Anaconda via Docker.

(我正在按照此处给出的说明通过Docker在Anaconda下运行Jupyter笔记本。)

In this code:

(在此代码中:)

docker run -i -t -p 8888:8888 continuumio/miniconda /bin/bash
-c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir
/opt/notebooks && /opt/conda/bin/jupyter notebook
--notebook-dir=/opt/notebooks --ip='*' --port=8888
--no-browser"

I get a failure when it is running this piece:

(运行此片段时出现故障:)

/opt/conda/bin/jupyter notebook
    --notebook-dir=/opt/notebooks --ip='*' --port=8888
    --no-browser"

Here is the error coming up:

(这是即将出现的错误:)

[I 19:20:47.620 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'allow_remote_access'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 864, in _default_allow_remote
    addr = ipaddress.ip_address(self.ip)
  File "/opt/conda/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "</opt/conda/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
  File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1628, in initialize
    self.init_webapp()
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1378, in init_webapp
    self.jinja_environment_options,
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 159, in __init__
    default_url, settings_overrides, jinja_env_options)
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 252, in init_settings
    allow_remote_access=jupyter_app.allow_remote_access,
  File "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 867, in _default_allow_remote
    for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
  File "/opt/conda/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

I tried this with a couple of different images but always get stuck at the same place.

(我尝试了几个不同的图像,但是总是卡在同一位置。)

Anyone have a clue?

(有人知道吗?)

  ask by shuntera translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You want the notebook to bind to a wildcard address, which 0.0.0.0 will bind to all hosts inside a network, which is what you want here (docker containers are like self-contained networks).

(您希望笔记本绑定到一个通配符地址,该地址将0.0.0.0绑定到网络内的所有主机,这就是您想要的(docker容器就像独立网络一样)。)

I'm not sure what * will result in, it appears to match to an empty address ''

(我不确定*会导致什么,它似乎与空地址匹配'')


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...