I’m creating a course that will require students to run some software called PyStan. It turns out that this is only partially supported on Windows.
Someone gave me an idea to use Docker so that students wouldn’t have any issue getting the software they need to do assignments. The end goal is that students can do very little to get Jupyter Lab up and running on their own machines, with as little effort as possible.
I tried writing the following to be run with sudo docker compose up
version: '3'
services:
ubuntu_anaconda:
image: continuumio/anaconda3:latest
container_name: ubuntu_anaconda
environment:
- LANG=C.UTF-8
- JUPYTER_TOKEN=my_secret_token # Set your desired token here
ports:
- "8888:8888" # Expose Jupyter Lab port
volumes:
- ./data:/data # Add this line if you want to mount a local directory to the container
command: /bin/bash -c "/opt/conda/bin/conda install -y -c conda-forge pystan && /opt/conda/bin/jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --NotebookApp.token=$${JUPYTER_TOKEN}"
However, when I open up a web browser and navigate to http://localhost:8888/
or http://localhost:8888/?token=my_secret_token
it says
The connection was reset
The connection to the server was reset while the page was loading.
- The site could be temporarily unavailable or too busy. Try again in a few moments.
- If you are unable to load any pages, check your computer’s network connection.
- If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.
On the other hand, when I navigate to https://127.0.0.1:8888/ it says
Secure Connection Failed
An error occurred during a connection to 127.0.0.1:8888.
PR_END_OF_FILE_ERRORError code: PR_END_OF_FILE_ERROR
- The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
2
Answers
Root Cause
Seems your container is not reachable by some network setting… Not sure what happened, I would need to know your whole set up. Maybe or necessary just restart the pc and try the following steps.
Solution
I tested your docker compose file on an ubuntu 24 host and it works fine. I started up the jupyter session as follows (I allowed root just because it is intended to be local and non production env):
Extra Ball
In your use case It maybe more intuitive with Visual Studio pluggings
Add dev container configuration files
From docker-compose.yml
(it will detect your file)I hope this two insights help you! 🙂
Here is docker-compose that works for me, it only requires create directory
./notebooks
with permission777
or to be owner by user id1000