2. Installation¶
2.1. Directory setup¶
Before we install the development-environment, we will first create a set of folders within your host operating system. These folders will be mounted within the development-environment Docker container when it is run to allow you to access the files in these folders from within the container (much like how you would map/mount a drive on Windows, Mac, or Linux). The following commands for running development-environment Docker containers expect the following folder structure:
development-environment
└───work
| bashrc
|
└───usr
|
└───bin
│ start.sh
│ start-notebook.sh
│ start-singleuser.sh
│ start-ssh-server.sh
| start-pycharm.sh
| mount-shared-drive.sh
│ fix-permissions
|
└───etc
│ │
│ └───jupyter
│ jupyter_notebook_config.py
│
└───local
│
└───cache
│
└───java
│
└───config
│
└───PyCharm
This folder structure contains:
work- this will be your main working directory.usr/bin- folder containing scripts for running different programs in the container e.g. jupyter servers etc.usr/etc/jupyter- folder containing jupyter notebook configuration.usr/localandusr/cache- folders where new python modules installed will be stored.usr/java,usr/config, andusr/PyCharm- folders used by IDEs.
Warning
The working development-environment/work directory created on the host machine will be mapped to /home/jovyan/work within the Docker container. Only items within folders that are mapped from the host operating system to the container will persist once the container is shutdown. Any files outside these folders will not be recoverable (running a Docker container can be thought of as getting a new computer with a fresh installation - only items in the mapped drive will be available the next time you start the Docker container).
This folder structure and its associated files have been stored in the following zip file (See zip file). Simply extract the folder as described below:
Windows¶
Move the downloaded zip file to your
Documentsfolder (this is typically located inC:/Users/USER_NAME/Documents/, where USER_NAME is your Windows login name).Extract the zip file into this folder.
Once extracted, the
development-environmentfolder should be found inC:/Users/USER_NAME/Documents/development-environment.
Important
Check the extracted folder to ensure that the zip file was extracted as
C:/Users/USER_NAME/Documents/development-environmentand notC:/Users/USER_NAME/Documents/development-environment/development-environment.
Important
If your Documents folder is hosted on e.g. Microsoft One Drive, then manually create the Documents folder specified in Step 1 above and follow the subsequent steps described above.
Note
If you would like to have the directory structure stored in a different location e.g. on drive other than C: then:
Open the files in the
start_pycharm_from_windows.batwith a text editor such as Notepad++.Search for all occurrences of
c/Users/%UserName%/Documents/and replace it with the path to where you want to store your directory structure.Continue from Step 2 above.
Note
Docker does not support mounting of network drives, so please select a physical drive to store your directory structure.
Linux and Mac¶
Go to your home directory and extract the zip file. For example, on linux ~ refers to /home/$USER/. Once extracted, the development-environment folder should be located in /home/$USER/development-environment.
cd ~
wget https://dev-container.readthedocs.io/en/latest/_static/development-environment.zip
unzip development-environment.zip
2.2. Installing docker¶
Now that the your directory structure has been setup, the next step is to install Docker Desktop.
Windows¶
1. Install Docker Desktop. 3. Restart your machine.
Linux¶
Follow instructions on Docker’s engine install documentation.
Follow the instructions on the Manage Docker as a non-root user section on Docker’s linux-post install documentation to add your username to the docker group. This will enable you to run docker without requiring super user permission. This is important to ensure that all the files generated by the docker are owned by the user and not the root superuser.
Once installed, the docker service should already be running.
Change permissions on the
development-environmentfolder that was downloaded in the previous section to allow read and write permissions for the docker group.
Mac¶
On Mac, install Docker Desktop for Mac (macOS) from docs.docker.com/engine/install/
Open the Docker Desktop For Mac app.