JupyterLab on Docker on Ubuntu 20.04 on WSL2

Docker Desktop for Windowsのインストールまでは前回。
kanekkie.hatenablog.com

anaconda3コンテナの入手。
hub.docker.com

$ docker pull continuumio/anaconda3
Using default tag: latest
latest: Pulling from continuumio/anaconda3
68ced04f60ab: Pull complete
57047f2400d7: Pull complete
8b26dd278326: Pull complete
Digest: sha256:6502693fd278ba962af34c756ed9a9f0c3b6236a62f1e1fecb41f60c3f536d3c
Status: Downloaded newer image for continuumio/anaconda3:latest
docker.io/continuumio/anaconda3:latest

起動。
オプションなどはこの辺を参考。
qiita.com
mick3355-dev.hatenablog.com

$ cd ~
$ mkdir workspace
$ docker run -it -p 8888:8888 -v $(pwd):/opt/notebooks continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/jupyter lab --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"
[I 15:06:45.627 LabApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 15:06:45.761 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 15:06:45.766 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
[I 15:06:45.766 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 15:06:45.768 LabApp] Serving notebooks from local directory: /opt/notebooks
[I 15:06:45.768 LabApp] The Jupyter Notebook is running at:
[I 15:06:45.768 LabApp] http://53249cd5486a:8888/?token=09f221636739c75fe67f0204d7b85b1df18e4986e26b0c51
[I 15:06:45.769 LabApp]  or http://127.0.0.1:8888/?token=09f221636739c75fe67f0204d7b85b1df18e4986e26b0c51
[I 15:06:45.769 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:06:45.771 LabApp]

    To access the notebook, open this file in a browser:
        file:///root/.local/share/jupyter/runtime/nbserver-1-open.html
    Or copy and paste one of these URLs:
        http://53249cd5486a:8888/?token=09f221636739c75fe67f0204d7b85b1df18e4986e26b0c51
     or http://127.0.0.1:8888/?token=09f221636739c75fe67f0204d7b85b1df18e4986e26b0c51

出てきたURLにアクセスすればいつもの画面が表示される。
f:id:kanekkie:20200603002326p:plain