Update README, Dockerfile, requirements, and add docker-compose for Jupyter Notebook setup
This commit is contained in:
@@ -1,5 +1,73 @@
|
|||||||
# Jupyter-my-own-image
|
# Jupyter Notebook Docker Setup
|
||||||
|
|
||||||
This is my custom image of python jupyter.
|
This repository contains Docker configuration for running Jupyter Notebook with various data science libraries pre-installed.
|
||||||
|
|
||||||
This repo was created to run jupyter in docker on raspberry pi (arm)
|
## Features
|
||||||
|
|
||||||
|
- Based on Ubuntu Focal (20.04)
|
||||||
|
- Includes Jupyter Notebook with:
|
||||||
|
- Pandas
|
||||||
|
- OpenCV
|
||||||
|
- Scikit-learn
|
||||||
|
- Scikit-image
|
||||||
|
- PyTorch
|
||||||
|
- Imutils
|
||||||
|
- Notebook export capabilities (nbconvert)
|
||||||
|
- Volume mounted for persistent notebook storage
|
||||||
|
- Two deployment profiles (build locally or pull from registry)
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── Dockerfile # Docker image definition
|
||||||
|
├── docker-compose.yml # Services configuration
|
||||||
|
├── requirements.txt # Python package dependencies
|
||||||
|
└── notebooks/ # Directory for your Jupyter notebooks (will be created)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Create notebooks directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p notebooks
|
||||||
|
```
|
||||||
|
|
||||||
|
### Profile 1: Build locally
|
||||||
|
|
||||||
|
To build the Docker image locally and run the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose --profile build up
|
||||||
|
```
|
||||||
|
|
||||||
|
### Profile 2: Pull from your registry
|
||||||
|
|
||||||
|
To pull the image from your private registry and run it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
REGISTRY_URL=your-registry-url docker-compose --profile registry up
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `your-registry-url` with your actual Docker registry URL.
|
||||||
|
|
||||||
|
## Accessing Jupyter Notebook
|
||||||
|
|
||||||
|
Once the container is running, access Jupyter Notebook by opening a browser and navigating to:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://localhost:8888
|
||||||
|
```
|
||||||
|
|
||||||
|
No password is required (for simplicity - you may want to add authentication for production use).
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
- To add more Python packages, modify the `pip3 install` command in the Dockerfile
|
||||||
|
- To change the Jupyter configuration, modify the command in docker-compose.yml
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- The notebooks directory is mounted as a volume to persist your work
|
||||||
|
- For security in production environments, consider adding authentication to your Jupyter instance
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
jupyter:
|
||||||
|
profiles: ["build", "registry"]
|
||||||
|
image: https://git.seccodesmith.pl/seccodesmith/Jupyter-my-own-image.git
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8888:8888"
|
||||||
|
volumes:
|
||||||
|
- ./notebooks:/notebooks
|
||||||
|
environment:
|
||||||
|
- JUPYTER_ENABLE_LAB=yes
|
||||||
|
restart: unless-stopped
|
||||||
|
command: >
|
||||||
|
jupyter notebook
|
||||||
|
--ip='0.0.0.0'
|
||||||
|
--port=8888
|
||||||
|
--no-browser
|
||||||
|
--NotebookApp.token=''
|
||||||
|
--NotebookApp.password=''
|
||||||
|
--allow-root
|
||||||
+10
-11
@@ -6,20 +6,19 @@ RUN apt-get update && apt-get install -y \
|
|||||||
python3 \
|
python3 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
build-essential \
|
git \
|
||||||
pandoc \
|
wget \
|
||||||
texlive-xetex \
|
curl \
|
||||||
libsm6 \
|
&& apt-get clean \
|
||||||
libxext6 \
|
|
||||||
libxrender-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
COPY requirements.txt /tmp/
|
||||||
|
|
||||||
COPY requirements.txt .
|
RUN pip3 install --no-cache-dir --upgrade pip && \
|
||||||
RUN pip3 install --no-cache-dir --upgrade pip \
|
pip3 install --no-cache-dir -r /tmp/requirements.txt
|
||||||
&& pip3 install --no-cache-dir -r requirements.txt
|
|
||||||
|
WORKDIR /notebooks
|
||||||
|
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--allow-root", "--no-browser", "--NotebookApp.token=''"]
|
CMD ["jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root"]
|
||||||
+5
-3
@@ -1,10 +1,12 @@
|
|||||||
jupyterlab
|
jupyter
|
||||||
notebook
|
notebook
|
||||||
nbconvert
|
nbconvert
|
||||||
numpy
|
numpy
|
||||||
pandas
|
pandas
|
||||||
matplotlib
|
opencv-python
|
||||||
scikit-learn
|
scikit-learn
|
||||||
scikit-image
|
scikit-image
|
||||||
torch
|
torch
|
||||||
torchvision
|
torchvision
|
||||||
|
torchaudio
|
||||||
|
imutils
|
||||||
Reference in New Issue
Block a user