Skip to content

Run Jupyter in a Container

JupyterLab is a powerful web-based interactive development environment ideal for working with notebooks, code, and data. It’s widely used across data science, machine learning, and education due to its flexible, interactive features.


Use Cases

  • Data Cleaning & Transformation
    Clean and transform raw datasets using Python libraries like Pandas and NumPy.

  • Education & Learning
    Great for teaching and learning Python, data science, or machine learning interactively.

  • Data Analysis & Visualization
    Perform exploratory analysis and create visualizations with tools like Seaborn and Matplotlib.

  • Machine Learning Prototyping
    Build, test, and iterate on models in one unified, reproducible notebook environment.


Steps

Step 1: Create a docker image with a minimal Dockerfile

  1. Create dockerfile with default commmands

    1
    2
    3
    4
    5
    FROM quay.io/jupyter/minimal-notebook:latest
    
    EXPOSE 8888
    
    CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser"]
    

  2. Build and push your container image to your registry


Step 2: Deploy on Serverless Containers

  1. Log in to cloud.tilaa.com

  2. Create a container

  3. Under Configuration:

  4. Expose port 8888

  5. Enable Internet Access
  6. Add an Ingress Rule:

    • Domain: Custom or generated domain
    • HTTP Port: 8888
    • TLS: Enabled
    • IP Allow-list: Optional (for restricted access)
  7. Fill in remaining details and click Add Container

  8. Once running, open the Logs

  9. Locate the startup line containing the URL:

http://127.0.0.1:8888/?token=abc123...

Copy the token value after ?token=

  1. Visit the domain from your ingress

  2. Log in using the token or set up a password


Best Practices

  • Save your token somewhere safe for reuse
  • Set up a password for simpler access
  • Use the terminal or notebook cells to install additional packages dynamically

FAQs

What do the arguments in the CMD mean?

Argument Description
jupyter Calls the Jupyter CLI
notebook Starts the notebook server
--ip=0.0.0.0 Binds to all available interfaces, required for container access
--port=8888 Specifies the port, must match the EXPOSE setting
--no-browser Prevents Jupyter from launching a browser automatically

How do I add packages to a Jupyter Notebook?

In the Dockerfile (before image creation)

RUN pip install <package>

From a notebook cell (after deployment)

!pip install <package>

Using the Jupyter Terminal

  • Click New > Terminal
  • Run:

    pip install <package>
    

What's Next

For more on Jupyter and its features, visit the official documentation.