Skip to content

[BUG] Docker run on mac cannot access localhost:8889 #491

@expe-elenigen

Description

@expe-elenigen

Community Note

  • Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the bug
If we try to use this project with docker:
docker build -t aws/graph-notebook-conf .
At the runtime, there's a minor issue :

[W 2023-05-18 01:10:43.536 ServerApp] No web browser found: Error('could not locate runnable browser').
Which can be addressed easily in:
/docker/service.sh

nohup jupyter notebook --ip='*' --port ${NOTEBOOK_PORT} "${WORKING_DIR}/notebooks" --allow-root > jupyterserver.log &
nohup jupyter lab --ip='*' --port ${LAB_PORT} "${WORKING_DIR}/notebooks" --allow-root > jupyterlab.log &

We can fix it by adding the flag --no-browser

nohup jupyter notebook --ip='*' --port ${NOTEBOOK_PORT} "${WORKING_DIR}/notebooks" --no-browser --allow-root > jupyterserver.log &
nohup jupyter lab --ip='*' --port ${LAB_PORT} "${WORKING_DIR}/notebooks" --no-browser --allow-root > jupyterlab.log &

When the docker container is running, I cannot connect to it with my browser, I noticed that both lines previously mentioned in the file /docker/service.sh have the configuration --ip='*' which I believe have an impact on those logs at the runtime:

[C 01:10:43.401 NotebookApp] You must use Jupyter Server v1 to load JupyterLab as notebook extension. You have v2.5.0 installed.
You can fix this by executing:
pip install -U "jupyter-server<2.0.0"
[I 01:10:43.405 NotebookApp] Serving notebooks from local directory: /root/notebooks
[I 01:10:43.405 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 01:10:43.405 NotebookApp] http://docker-desktop:8888/

and

[I 2023-05-18 01:10:43.519 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-05-18 01:10:43.526 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-05-18 01:10:43.528 ServerApp] Serving notebooks from local directory: /root/notebooks
[I 2023-05-18 01:10:43.528 ServerApp] Jupyter Server 2.5.0 is running at:
[I 2023-05-18 01:10:43.528 ServerApp] http://localhost:8889/lab
[I 2023-05-18 01:10:43.528 ServerApp] http://127.0.0.1:8889/lab

I presume the issue here is the hostname http://docker-desktop:8888/ while we see that for the lab part it's using correctly hostname in http://localhost:8889/lab. From what I understand, when we package Junyper in docker, it's a common practice to have:

  • --ip 0.0.0.0
  • --no-browser
  • --allow-root

I tried to change the configuration to replacing --ip='*' by --ip 0.0.0.0 but it didn't worked, then I tried to modify /docker/service.sh by adding:
echo "c.ServerApp.ip = \"0.0.0.0\"" >> ~/.jupyter/jupyter_notebook_config.py like it's the case here:
https://github.com/jupyter/docker-stacks/blob/b378681adad0506b3613cde9d8a35c3e246dfe71/base-notebook/jupyter_server_config.py#L11-L12
This change didn't fix the issue, so I'm considering to use jupyter/minimal-notebook as a workaround.

  • OS: MacOS 13.3.1
  • Browser: Google Chrome
  • Graph Notebook Version: N/A
  • Graph Database & Version: N/A

To Reproduce
Steps to reproduce the behavior:

  1. Clone the current repository
  2. docker build -t aws/graph-notebook-conf .
  3. docker run --network="host" -p 8889:8889 -p 8888:8888 -v ~/dev/graph-notebook/out:/working -e GRAPH_NOTEBOOK_HOST=xyz.us-west-2.neptune.amazonaws.com -e AWS_REGION=us-west-2 -e GRAPH_NOTEBOOK_SSL=False aws/graph-notebook
  4. Opening Chrome with http://localhost:8889/lab

If applicable, add screenshots to help explain your problem.

Expected behavior
JypiterLab should accessible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Resolved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions