I need to present a series of results and calculations that use GPUs. I concluded that I should create a Docker Container that can I can use in creating and installing my python package AND that can run my notebooks on the python package.
I decided to start with this base image: nvidia/cuda:12.3.1-devel-ubuntu22.04
and created this Dockerfile
FROM nvidia/cuda:12.3.1-devel-ubuntu22.04
# Set DEBIAN_FRONTEND to noninteractive to prevent tzdata configuration dialog
ENV DEBIAN_FRONTEND=noninteractive
USER root
RUN mkdir /app && cd /app
# Set the working directory
WORKDIR /app
# Mark /app as a volume to be mounted
VOLUME /app
# Install gnupg
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y gnupg cmake && \
apt-get install -y build-essential dkms wget apt-utils && \
apt-get install -y pkg-config libcairo2-dev && \
apt-get install -y software-properties-common && \
apt-get install -y python3-cairo-dev && \
apt-get install -y netstat-nat telnet && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Download and install pip for Python 3 using get-pip.py script
RUN apt-get update && apt-get install -y curl python3-venv
RUN apt-get install -y python3-dev
RUN ln -s /usr/bin/python3 /usr/bin/python
# Add a line to activate the virtual environment in ~/.bashrc
RUN echo "source /myvenv/bin/activate" >> /root/.bashrc
# Copy requirements and install Python packages
COPY requirements.txt .
# Create and activate a virtual environment
RUN python3 -m venv /myvenv && \
. /myvenv/bin/activate && \
pip install pycairo && \
pip install -r requirements.txt
EXPOSE 8888
# Copy the start script and make it executable
COPY start.sh .
RUN chmod +x start.sh
# Start your application with CMD
CMD ["source /myvenv/bin/activate", "/bin/bash", "/app/start.sh"]
The docker-compose.yml is this:
version: '3'
services:
pytorch-container:
build:
context: /home/mp74207/CLionProjects/HU_GalaxyPackage # Replace with the path to the directory containing your Dockerfile
dockerfile: Dockerfile # Replace with the actual name of your Dockerfile if it's different
volumes:
- /home/mp74207/CLionProjects/HU_GalaxyPackage:/app
working_dir: /app
# command:
# - /bin/bash
# - -c
# - "tail -f /dev/null"
# - source /myvenv/bin/activate && jupyter-server
command:
- /bin/bash
- -c
- |
cd /app
source /myvenv/bin/activate
jupyter server --allow-root --ip 0.0.0.0 --port 8888 --notebook-dir='/app'
container_name: hu-galaxy-container
ports:
- "8888:8888"
I can run the container and start the jupyter server. When I go to the 121.0.0.1:8888 on the host I find a page with “Jupyter is running”.
Somehow I cannot pass the starting directory. I hoped to see the same thing I see when I run anaconda-navigator. I don’t.
I tried several combinations of jupyter server , jupyter notebook, and jupyter commands but failed to find the correct combination.
So, this is not really about JupyterHub. I couldn’t find an option for just Jupyter Server.
Of course, if one know how to make it work with jupyterhub, I will be happy to change program. The network seems to be ok since I can see the Jupyter is Working in the host.
Any help would be amazing…
Thanks in advance.