Docker image opens JupyterLab in tf directory despite declaring WORKDIR in Dockerfile

As stated in the title, I declare the WORKDIR in my Dockerfile as ‘/tf-project’, yet JupyterLab opens up with the directory ‘/tf’. It’s technically not a big deal since I can just remap the WORKDIR to that same folder and work from there. But, in case I ever have need to do otherwise, I want to understand why it’s doing this and how to “fix” it. Apparently JupyterLab opens a default directory based on a file named ’ `jupyter_notebook_config.py’. When I searched my WSL and Docker image file system, I could find no such file. But clearly the image is set up to go to this file dir. What am I missing?

Hi @Jory_Ferrell ,

Thank you for using TensorFlow,
This is the Dockerfile I wrote based on the information in your issue,

FROM tensorflow/tensorflow:latest-jupyter

WORKDIR /tf_project

ADD . /tf_project

RUN pip install --upgrade pip && \
    pip install numpy pandas matplotlib scikit-learn

EXPOSE 8888

CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--allow-root", "--no-browser", "--NotebookApp.token=''"]

These commands for building the image and running a container on the image.

docker build -t my-tf-jupyter .

docker run -p 8888:8888 -v $(pwd):/tf_project my-tf-jupyter

I found that the Jupyter notebook opens in the working directory and the file changes are in the same folder where I started the notebook. In the container, the changes are in the tf_project folder, which we specified in dockerfile.

The folder contents in the working directory

image

The folder contents in Jupyter notebook, which is open through container,