I am defining the setup of a VS Code Dev Container for Data Science. To do so, I want the following Dev Container Main Configurations and Installations:
- Miniconda3, including Python, Jupyter Notebooks, and more.
- Using conda to install a pre-defined conda environment.
- Volume Mapping: A volume will be used to map a directory on your local file system to a directory inside the Docker container. This way, any changes you make to your code locally will be immediately reflected inside the container, where you can run and test the code.
- Git: A distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development.
- VS Code, including extensions like Python, Jupyter Notebooks, Docker, PyLance and more.
The issue is, that the Starting Working Directory of a Jupyter Notebook within the Dev Container is not the working directory of the notebook, but the root container directory. Of course I can change this within the notebook, but I would need to do so in every notebook. So I wonder if it is possible to set this configuration within the Dockerfile, docker-compose.yml, devcontainer.json or in another elegant way? It is also to note that this is related to jupyter notebooks and is not the case for standard python scripts.
You can find my Dev Container Setup with the given use case in this repo. Container should start without any issues. Access permission is limited to the "workspace" folder and of course can be changed.
Starting working dir of jupyter notebook within the Dev Container
Tried:
- Setting the WORKDIR to "/workspace" in Dockerfile or compose-docker.yml does not solve the issue.
- searched in Microsoft Dev Container Dokumentation how to handle this issue.
- searched at Stack overflow to handle this issue.
- googled to handle this issue.