Hi there,
I’m running one of the Jupyter Docker stacks, image name quay.io/jupyter/pytorch-notebook:cuda12-python-3.11.8
. This is great, however I am finding one issue less convenient; being that the (pip) packages that I install are not persisted, so they need to be reinstalled every time I start up my containers again.
Solution sought:
A way to have pip package installed and persisted(!) when starting up the docker container for the first time.
What I’ve done so far:
I am running this docker container via a custom docker-compose.yml with this content:
services:
jupyterlab:
image: quay.io/jupyter/pytorch-notebook:cuda12-python-3.11.8
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
ports:
- "8888:8888"
working_dir: /home/jovyan
volumes:
- ./startup_hooks:/usr/local/bin/start-notebook.d/
- ./src:/home/jovyan/src
env_file:
- .env
command:
- start-notebook.py
- --PasswordIdentityProvider.hashed_password=${JP_PASS}
The volume mounted initiates a shell script that looks like:
#!/bin/bash
pip install -r /absolute_path_to/requirements.txt
This works fine but as stated every time I reboot the container, the pip packages have to be reinstalled all over again and this takes some time.
I’m assuming one possible way of solving this problem is to use a custom Dockerfile in which I simply RUN pip install ...
however I can’t seem to find the Dockerfile being used in the image I currently use, nor information on how to use a custom docker file.
Any suggestions are greatly appreciated, thanks in advance!