我有一个简单的 Dockerfile
FROM ubuntu:latest
RUN pip install cython jupyter
EXPOSE 8888 4040
CMD ["jupyter", "notebook", "--ip=127.0.0.1", "--port=8888", "--allow-root", "--no-browser"]
我构建它并启动一个这样的容器:
docker container run -d -p 8888:8888 -p 4040:4040 --name test_run my_custom_image
然后我检查日志以获取 jupyter 登录 token :
docker container logs test_run
...
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://127.0.0.1:8888/?token=7bf22f85e7b942b9936b1403523ba8c334a62bdd278376fc
然后我尝试 curl 链接,但我得到了这个:
curl http://127.0.0.1:8888/tree?token=7bf22f85e7b942b9936b1403523ba8c334a62bdd278376fc
curl: (56) Recv failure: Connection reset by peer
如果我运行
docker container exec -it test_run bash
并从那里运行 curl,它正在工作运行
netstat -tupln
在主机上:tcp6 0 0 :::8888 :::* LISTEN
运行
netstat -tupln
在容器中:tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 1/python
有小费吗?
最佳答案
更改了 --ip=127.0.0.1
至 --ip=0.0.0.0
它解决了我的问题..
关于docker - 从 Docker : curl: (56) Recv failure: Connection reset by peer 运行 Jupyter Notebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55700517/