Sunday, February 10, 2019

Running Jupyter Notebook from Docker Container - Part 2

  1. Step 1. Create a Directory at an appropriate place in your Linux Environment with 755 privileges (Not advisable for production) 
mkdir -m 755 DockerExample 

  1. Step 2. Go inside the newly created Dir. This Directory would act as a  shared folder with the new Docker Container: 
cd DockerExample 

  1. Step 3. Now as our original goal is to run the Jupyter Notebook from the Docker container, we need to expose the port of Jupyter server to the host. Run below command in your terminal 
sudo docker run -v$(pwd):/sharedfolder --name=jNotebook -p 9294:8888 -i -t ubuntu 

  1. Now you must be inside Docker Container. Validate "sharedfolder" folder by
     ls –a 
    "sharedfolder" is the folder which is shared with Host OS/ 

  1. Step 4. Copy script from 
  3. Save it in a textfile with the name JupyterfromDocker and with an extension .sh (which means the full name of the file should be inside DockerExample directory.
  1. Step 5. Change Script Permissions:
  2. Before running the script, ensure it has all the permission and is executable. See the below screenshot to make it executable 
  5. Step 6. Find script
  1. Now go back to the Docker container and in the terminal, go the sharedfolder directory to verfiy if the script is there or not.
  2. cd sharedfolder
  3. ls -a
  6. Step 7. Run script and do ensure to press y wherever necessary(Its an interactive script)
  7. ./ 
  8. Configure TimeZone and Geo Location
  9. Step 8. Once the scripts runs successfully, you should see the below output:
Copy token from above output and got to your host web browser to open following url: localhost:9294 and paste it inside the password or token input window to login:


No comments:

Post a Comment