How to setup Jupyter Notebook in a docker container through docker-compose file.

version: "3"
    image: jupyter/datascience-notebook
      - /Users/faisal/Projects/docker-jupyter:/home/jovyan/work
      - 8888:8888
    container_name: datascience-notebook-container
      - JUPYTER_TOKEN=easy
    command: jupyter notebook --NotebookApp.iopub_data_rate_limit=3e10
jupyter docker-compose

Make sure to replace “/Users/faisal/Projects/docker-jupyter” with your own local path. After that simply run docker-compose up in the directory where you have placed the snippet above. Above configuration will setup jupyter on http://localhost:8888/ with “easy” as your token.

Detailed information

Benefits of developing on Jupyter through docker

This approach is recommended for development setups only

  • Auto installation
  • Automatic Jupyter version updates
  • Auto upgrade when you update image

  • Persistent storage support

  • Easily setup for multiple envoirnments

  • Docker configs in Docker compose so need to remember parameters

  • Easily set environment variables

What are Jupyter Notebooks?

Jupyter notebooks are like documents where you can execute chunks of programming code one chunk at a time. You can do everything from creating interactive maps to creating interesting data visualizations and even embedding videos. Jupyter notebooks are open-source and was designed for interactive data science and scientific computing. Data Scientists used Jupiter notebooks because in data science you are often
exploring your data or building models and needing to see the outputs of parts of your code quite frequently which Jupyter notebooks enable. Jupyter notebooks were also designed to be shared with others you can tell stories in Jupyter notebooks with your data by combining your code with explanatory text output from your code images and videos.

What is Docker?

Docker is mainly a software development platform and a kind of virtualization technology that makes it easy for us to develop and deploy apps inside of neatly packaged virtual containerized environments. Meaning apps run the same, no matter where they are of what machine they are running on. Docker containers can be deployed to just about any machine without any compatibility issues so your software stays system agnostic, making software simpler to use, less work to develop, and easy to maintain and deploy. These containers running on your computer or server act like little microcomputers with very specific jobs, each with their operating system and their own isolated CPU processes, Memory, and Network resources. And because of this, they can be easily added, removed, stopped, and started again without affecting each other of the host machine.