This project provides a ready-to-use container image for running Python code and Jupyter notebooks.
It includes system dependencies (ODBC 18 driver, etc.) and is easily extensible via requirements.txt
and the Dockerfile
.
- Docker Desktop installed and running
- (Optional but recommended) VS Code with:
- Python extension
- Jupyter extension
# Replace <user_name> with your WSL username
sudo usermod -aG docker <user_name>
exec su -l <user_name> # restart your shell/session
Navigate to the directory containing your Dockerfile
:
cd <PATH TO DOCKERFILE PARENT DIRECTORY>
docker build -t base-container-image .
docker run -it --rm -v "$(pwd)":/app -p 8888:8888 base-container-image jupyter server --ip=0.0.0.0 --port=8888 --no-browser --allow-root --ServerApp.token=''
This launches a Jupyter server on http://localhost:8888.
Because the token is set to ''
, no authentication is required (fine for local dev — not safe for shared environments).
- Open your
.ipynb
file in VS Code - Click Select Kernel → Existing Jupyter Server
- Enter the URL:
http://localhost:8888
- Give it a name (e.g.,
python_kernel
)
You don’t have to use Jupyter — you can also run scripts directly against the container.
-
Find the running container:
docker ps
Note the CONTAINER ID.
-
Open a shell inside it:
docker exec -it <container_id> bash
-
Navigate to your file and run it:
cd /app/src python3 your_script.py
- Python dependencies → edit
requirements.txt
- System dependencies → edit
Dockerfile
(e.g., addapt-get install
lines)
Rebuild the image after changes:
docker build -t base-container-image .
- Always restart your WSL session after adding your user to the
docker
group. - For production use, configure a secure Jupyter token or password.
- Mounts: the current working directory on the host (
$(pwd)
) is mounted into/app
inside the container.