Skip to content

cpateldev/JupyterDotNetNotebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jupyter .NET Notebooks Docker Setup

This project provides a Docker container for running Jupyter Notebooks with .NET Interactive, .Net 9 SDK, Anaconda3 and Python 3.12.

Both dockerfile and docker-compose.yml files are generated using GitHub Copilot and then edited to fix minor bugs and improvements.

Table of Contents

Features

.NET 9 Anaconda 3 Python 3.12 Jupyter Python .NET Interactive

  • .NET SDK 9.0.200
  • Anaconda with Python 3.12 environment
  • Jupyter Notebook pre-installed
  • .NET Interactive for Jupyter
  • Optimized docker image.

NOTE: Dockerfile.bak is non-optimized version which shows step by step installation of each tool.

How to setup dev container

To add a development container configuration for this project, you need to create a .devcontainer folder with a devcontainer.json file. This file will define the settings for the development container.

Here is the updated devcontainer.json file:

{
    "name": "jupyterdotnetnotebooks",
    "dockerComposeFile": "../docker-compose.yml",
    "service": "jupyterlabwithdotnet",
    "workspaceFolder": "/home/user/notebooks",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-python.python",
                "ms-toolsai.jupyter"
            ]
        },
        "settings": {
            "terminal.integrated.shell.linux": "/bin/bash"
        }
    }
}

Make sure to create the .devcontainer directory in the root of your project and place the devcontainer.json file inside it.

This configuration will use the existing docker-compose.yml file to set up the development container, and it will use the jupyterlabwithdotnet service defined in your docker-compose.yml file.

How to open remote dev container

Remote Window Reopen in Container Command option

  • Click "Open a Remote Window" button as shown in screenshot
  • Select "Reopen in container" option

Usage

Build the Docker Image

To build the Docker image, run:

docker build -t jupyter-dotnet-notebooks .

Run the Container

To start the container:

docker run -p 8888:8888 jupyter-dotnet-notebooks

Access Jupyter Notebook

Open your browser and navigate to http://localhost:8888. Use the token provided in the container logs to log in.

Container Logs

Environment Details

  • User: user
  • Home Directory: /home/user
  • Python Environment: py3.12 (Python 3.12)
  • Path Updates:
    • /home/user/anaconda/bin
    • /home/user/.dotnet/tools
    • /home/user/anaconda/envs/py3.12/bin

Installed Tools

  1. Anaconda: Installed in /home/user/anaconda.
  2. .NET Interactive: Installed globally as a .NET tool with .Net 9 SDK.
  3. Jupyter Notebook: Installed in the Python 3.12 environment.

Notes

  • The container exposes port 8888 for Jupyter Notebook.
  • The Python environment py3.12 is activated by default in the container.

Project Structure

.
├── 📄 Dockerfile                   # Main Docker image build
├── 📄 docker-compose.yml           # Docker Compose configuration for
├── 📂 .devcontainer/               # VS Code development container
│   └── 📄 devcontainer.json        # Dev container settings and
└── 📂 notebooks/                   # Directory containing Jupyter
  ├── 📓 CS13-Features.ipynb        # C#13 features demonstration sample
  ├── 📓 Python_HelloWorld.ipynb    # Python sample notebook
  └── 📓 PowerShell-Scripts1.ipynb  # PowerShell scripting examples
  • Dockerfile: Contains the instructions to build the Docker image.
  • docker-compose.yml: Defines the services and configurations for Docker Compose.
  • .devcontainer/: Contains the development container configuration.
  • notebooks/: Directory to store your Jupyter Notebooks.

Contributing

Feel free to submit issues and pull requests. Contributions are welcome!

License

This project is licensed under the MIT License.

Go to TOC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published