Continous updating of Single user Server Container

I am facing a common challenge with Docker containers in a JupyterHub environment. Once a single user server container is spawned from an image, it’s essentially a snapshot of that image at that point in time. If I make changes to the image afterwards, those changes won’t automatically propagate to existing containers.

Any Ideas that i can keep Containers of single user servers uptodate?

In general containers are designed to provide a fixed reproducible environment. You could play around with persistent volumes and paths, e.g. to create a Conda/Python environment on persistent storage and modifying the image to use those paths instead of what’s built-in to the image, but there’s nothing that would let you persist the entire state of the container.

1 Like

sorry to say that it is not a solution

JupyterHub is too big, TLJH is overkill, best for a couple of friends to work on a safe jupyter environment would be, I guess, jupyter-service running at least one of docker-stack.

home at jovyan, there is .condarc to keep pkg cache,where I am now. If I can persist at least the package caches there,maybe I can spin-up containers way faster.

---
networks:
  dev_net:
    external: true

services:
  jupyter:
    image: quay.io/jupyter/scipy-notebook:latest
    container_name: jupyter
    user: root
    networks:
      - dev_net
    environment:
      - JUPYTER_ENABLE_LAB=yes
      - GRANT_SUDO=yes
      - NB_USER=jovyan
      - NB_UID=1001
      - NB_GID=1001
      - CHOWN_HOME=yes
      - CHOWN_HOME_OPTS=-R
      - RESTARTABLE=yes
    command: start-notebook.py --IdentityProvider.token='' --ServerApp.root_dir=/home/jovyan/notebooks --ServerApp.port=8888 --ServerApp.password='' --ServerApp.allow_root=True

    volumes:
      - ${HUBDIR}/notebooks:/home/jovyan/notebooks
      - ${HUBDIR}/dev/jupyter/jovyan/.jupyter:/home/jovyan/.jupyter
      - ${HUBDIR}/dev/jupyter/jovyan/.condarc:/home/jovyan/.condarc
      - ${HUBDIR}/dev/jupyter/jovyan/.bashrc:/home/jovyan/.bashrc
      - ${HUBDIR}/dev/jupyter/jovyan/.bash_local:/home/jovyan/.bash_local
      - ${HUBDIR}/dev/jupyter/jovyan/.bash_aliases:/home/jovyan/.bash_aliases
      - ${HUBDIR}/dev/jupyter/jovyan/start-notebook.d:/usr/local/bin/start-notebook.d/
      - ${HUBDIR}/opt/conda/.conda:/home/jovyan/.conda

    labels:
      traefik.enable: true
      traefik.http.routers.jupyter.rule: Host(`jpy.${DEV_SUBDOMAIN}`)
      traefik.http.routers.jupyter.entrypoints: websecure
      traefik.http.services.jupyter.loadbalancer.server.port: 8888
      traefik.http.routers.jupyter.middlewares: authelia@file,securityHeaders@file,crowdsec-bouncer@file

    restart: unless-stopped