title: Use Jupyter together with file share or mounted folder
body: <p><strong>how can we synchronize notebooks between a jupyter service and other services (Google Cloud Storage or git repository)?</strong></p>
  
  <p>Some background on this question:</p>
  
  <p>Currently I am on the way moving from Google's Datalab to my own container. My motivation is to have more control over data region (Datalab Beta only offered in US) and packages as I want to use the current Tensorflow version.</p>
  
  <p>Based on the ideas by Google (<a href="https://github.com/GoogleCloudPlatform/datalab/tree/master/containers/datalab" rel="nofollow noreferrer">see github</a>), I build my own Docker image and run it on my Kubernetes cluster in the Google container engine.
  The <strong>GCP package</strong> can be installed as <a href="https://stackoverflow.com/questions/34859009/how-to-install-gcp-in-python/36608931#36608931">I have previously explained</a>.
  Google uses a <strong>node.js server to sync GIT</strong> with the datalab instance - However I was not able to get this running with a self-deployed container in EU.</p>
  
  <p>Second try was the <strong>GCSFuse driver</strong>. This one does not work for non-priviliged containers as of Kubernetes v1.0 and Google Container Engine. So full stop.</p>
  
  <p>My Docker file (based on Google's GCE Datalab image):</p>
  
  <pre><code>FROM debian:jessie
  
  # Setup OS and core packages
  RUN apt-get clean
  RUN echo "deb-src http://ftp.be.debian.org/debian testing main" &gt;&gt; /etc/apt/sources.list &amp;&amp; \
  apt-get update -y &amp;&amp; \
  apt-get install --no-install-recommends -y -q \
      curl wget unzip git vim build-essential ca-certificates pkg-config \
      libatlas-base-dev liblapack-dev gfortran \
      libpng-dev libfreetype6-dev libxft-dev \
      libxml2-dev \
      python2.7 python-dev python-pip python-setuptools python-zmq &amp;&amp; \
  mkdir -p /tools &amp;&amp; \
  mkdir -p /srcs &amp;&amp; \
  cd /srcs &amp;&amp; apt-get source -d python-zmq &amp;&amp; cd
  
  WORKDIR /datalab
  
  
  # Setup Google Cloud SDK
  RUN apt-get install --no-install-recommends -y -q wget unzip git -y
  RUN wget -nv https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip &amp;&amp; \
  unzip -qq google-cloud-sdk.zip -d tools &amp;&amp; \
  rm google-cloud-sdk.zip &amp;&amp; \
  tools/google-cloud-sdk/install.sh --usage-reporting=false \
      --path-update=false --bash-completion=false \
      --disable-installation-options &amp;&amp; \
  tools/google-cloud-sdk/bin/gcloud config set --scope=installation \
      component_manager/fixed_sdk_version 0.9.57 &amp;&amp; \
  tools/google-cloud-sdk/bin/gcloud -q components update \
      gcloud core bq gsutil compute preview alpha beta &amp;&amp; \
  rm -rf /root/.config/gcloud
  
  # Install FUSE driver for GCE
  RUN apt-get install -y lsb-release
  RUN echo "deb http://packages.cloud.google.com/apt gcsfuse-jessie main" &gt;     /etc/apt/sources.list.d/gcsfuse.list
  RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
  RUN apt-get update &amp;&amp; apt-get install -y gcsfuse
  RUN mkdir /datalab/mount
  
  # Setup Python packages
  RUN pip install -U \
      tornado==4.2.1 pyzmq==14.4.0 jinja2==2.7.3 \
      jsonschema==2.5.1 py-dateutil==2.2 pytz==2015.4 pandocfilters==1.2.4 pygments==2.0.2 \
      argparse==1.2.1 mock==1.2.0 requests==2.4.3 oauth2client==1.4.12 httplib2==0.9.2 \
      futures==3.0.3 &amp;&amp; \
      pip install -U numpy==1.9.2 &amp;&amp; \
      pip install -U pandas==0.16.2 &amp;&amp; \
      pip install -U scikit-learn==0.16.1 &amp;&amp; \
      pip install -U scipy==0.15.1 &amp;&amp; \
      pip install -U sympy==0.7.6 &amp;&amp; \
      pip install -U statsmodels==0.6.1 &amp;&amp; \
      pip install -U matplotlib==1.4.3 &amp;&amp; \
      pip install -U ggplot==0.6.5 &amp;&amp; \
      pip install -U seaborn==0.6.0 &amp;&amp; \
      pip install -U notebook==4.0.2 &amp;&amp; \
      pip install -U PyYAML==3.11 &amp;&amp; \
      easy_install pip &amp;&amp; \
      find /usr/local/lib/python2.7 -type d -name tests | xargs rm -rf
  
  # Path configuration
  ENV PATH $PATH:/datalab/tools/google-cloud-sdk/bin
  ENV PYTHONPATH /env/python
  
  # IPython configuration
  WORKDIR /datalab
  RUN ipython profile create default
  RUN jupyter notebook --generate-config
  ADD ipython.py /root/.ipython/profile_default/ipython_config.py
  
  # Install TensorFlow.
  RUN wget -nv https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl &amp;&amp; \
    pip install --upgrade tensorflow-0.7.1-cp27-none-linux_x86_64.whl &amp;&amp; rm tensorflow-0.7.1-cp27-none-linux_x86_64.whl
  
  
  # Add build artifacts
  ADD build/lib/GCPData-0.1.0.tar.gz /datalab/lib/
  ADD build/lib/GCPDataLab-0.1.0.tar.gz /datalab/lib/
  ADD setup-repo.sh /datalab
  ADD setup-env.sh /datalab
  ADD run.sh /datalab
  RUN chmod 755 /datalab/*
  
  # Install build artifacts
  RUN cd /datalab/lib/GCPData-0.1.0 &amp;&amp; python setup.py install
  RUN cd /datalab/lib/GCPDataLab-0.1.0 &amp;&amp; python setup.py install
  
  RUN mkdir /datalab/content
  WORKDIR /datalab/content
  EXPOSE 6006
  EXPOSE 8123
  # see https://github.com/ipython/ipython/issues/7062
  CMD ["/datalab/run.sh"]
  </code></pre>