How to store your notebooks locally wth jupyter/datascience-notebook docker image?

I got a Jupyter notebook environement that is working well with the following code :

version: '3'

volumes:
  jupyter:
    driver: local

networks:
  traefik_network:
    external: true

services:
  jupyter:
    image: jupyter/datascience-notebook
    networks:
      - traefik_network
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_network"
      - "traefik.port=8888"
      - "traefik.entryPoint=https"
      - "traefik.backend=jupyter"
      - "traefik.frontend.rule=Host:jupyter.mysite.com"
    volumes:
     - jupyter:/home/jovyan/work
    environment:
     - JUPYTER_ENABLE_LAB=yes
    command: start-notebook.sh --NotebookApp.token='mytoken' --no-browser --allow-root --notebook-dir=/home/jovyan/work

However I want to track the notebooks in version control. So that I would like to change the volume to:

volumes:
     - ./work:/home/jovyan/work

If then, the docker-compose will work with no warning. However when you enter the jupyter lab environment and create a notebook you get an “directory not found” error. The ./work directory actually exists on the server.

Source: StackOverflow