{"id":16509437,"url":"https://github.com/gitjeff05/jupyterlab-minimalist-image","last_synced_at":"2025-10-28T03:31:42.441Z","repository":{"id":43922080,"uuid":"289540742","full_name":"gitjeff05/jupyterlab-minimalist-image","owner":"gitjeff05","description":"A lightweight Docker image for Python, JupterLab, Numpy, Pandas, Matplotlib and scikit-learn","archived":false,"fork":false,"pushed_at":"2021-10-20T18:41:09.000Z","size":51,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-07-31T19:41:05.513Z","etag":null,"topics":["docker-images","dockerfiles","jupyter","jupyterlab","machine-learning","python"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitjeff05.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-22T18:03:25.000Z","updated_at":"2023-06-22T20:19:29.000Z","dependencies_parsed_at":"2022-07-11T00:30:32.109Z","dependency_job_id":null,"html_url":"https://github.com/gitjeff05/jupyterlab-minimalist-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitjeff05%2Fjupyterlab-minimalist-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitjeff05%2Fjupyterlab-minimalist-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitjeff05%2Fjupyterlab-minimalist-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitjeff05%2Fjupyterlab-minimalist-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitjeff05","download_url":"https://codeload.github.com/gitjeff05/jupyterlab-minimalist-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860228,"owners_count":16556025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-images","dockerfiles","jupyter","jupyterlab","machine-learning","python"],"created_at":"2024-10-11T15:50:30.076Z","updated_at":"2025-10-28T03:31:42.016Z","avatar_url":"https://github.com/gitjeff05.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimalist JupyterLab Docker Image\n\nA [lightweight](https://github.com/gitjeff05/jupyterlab-minimalist-image#results) Docker image for Python, [JupterLab](https://jupyterlab.readthedocs.io), [Numpy](https://numpy.org/), [Pandas](https://pandas.pydata.org/), [Matplotlib](https://matplotlib.org/) and [scikit-learn](https://scikit-learn.org/stable/).\n\n## To pull the image Docker Hub:\n```bash\n\u003e docker pull jusher/jupyterlab-minimalist:latest\n```\n\n## To start the container \n```bash\n\u003e docker run -it -p 8888:8888 \\\n  -w /home/jordan/work \\\n  --mount type=bind,src=\"$(pwd)\"/project,dst=/home/jordan/work \\\n  jusher/jupyterlab-minimalist:latest\n```\n\n# The Goals of this Project:\n\nA minimalist image, built from a small Dockerfile (~30 lines) that is easy to understand. This project should always aim to follow [Docker best practices](https://docs.docker.com/develop/dev-best-practices/) and in particular:\n\n1. Use an intuitive Dockerfile that is easy to extend\n2. Produce an image that is small as possible :\n    - using [multi-stage builds](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds)\n    - minimizing RUN, COPY, ADD commands\n    - minimizing dependencies\n3. Start with an appropriate base image (i.e., [Official Python Docker](https://hub.docker.com/_/python)) \n\nDisclaimer: **This is experimental.**  You should review the Dockerfile and test the image carefully before putting this in production. Feedback is welcome.\n\n## The Problem\n\nSetting up a local environment for data science is cumbersome. Between environment and dependency management, many hours can be spent on configuration before any work can begin.\n\n## The Benefits of Containerization\n\nA good way to create consistent, portable and isolated environments is containerization. Containers can be preconfigured with packages and software installed. They are efficient and can be shared easily.\n\nThe solutions discussed and implemented here will focus on containerization as opposed to environment managers like [Anaconda](https://www.anaconda.com/) or [Virtualenv](https://virtualenv.pypa.io/en/latest/#).\n\nFor a more in-depth rundown of containers, consider reading some good introductions by [NetApp](https://www.netapp.com/us/info/what-are-containers.aspx) and [Google](https://cloud.google.com/containers) and [Docker](https://www.docker.com/resources/what-container).\n\n# Existing Solutions\n\nCurrently, [Jupyter Docker Stacks](https://jupyter-docker-stacks.readthedocs.io/en/latest/) leverage the power of containerization to provide an array of Docker images for data science applications.\n\nHowever, the resulting images from Jupyter Docker Stacks are quite large and some other downsides include:\n  \n  - The Dockerfiles and startup scripts are long and somewhat difficult to follow\n  - The images arguably violate the [best practice of decoupling](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#decouple-applications) (e.g., by including packages like inkscape, emacs, vim, git)\n  - The base image chain is complex (e.g., to extend `jupyter/scipy-notebook`, one must have understand the base image hierarchy and their scripts:\n    - `ubuntu:focal` \n      - `jupyter/base-notebook`\n        - `jupyter/minimal-notebook`\n          - `jupyter/scipy-notebook`\n\nIf you require Conda or JupyterHub, then Jupyter Docker Stacks is a good option for you. They also support R, Spark, TensorFlow, Julia and other kernels that this project does not (yet). However, I have used this same setup to [create a Pytorch image](https://github.com/gitjeff05/jupyterlab-minimalist-image/tree/master/dockerfiles/pytorch) with success. It would certianly be possible to do others.\n\n## Approach\n\nWe desired a solution based off the [Official Python Docker image](https://hub.docker.com/_/python). Why does this matter? [Starting with an appropriate base image](https://docs.docker.com/develop/dev-best-practices/#how-to-keep-your-images-small) is a best practice and helps reduce the complexity and size of the image. We also employ [multi-stage builds](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds) which reduces the build time and provides efficiencies for extending the image.\n\n## Results\n\nThe resulting image is built from a ~30 line Dockerfile and results in a 864MB image. A comparison with jupyter/scipy-notebook is shown below.\n\n| Image  | # Layers | # lines in Dockerfile | Size | \n|---|---|---|---|\n| `jupyterlab-minimalist`  | 10  | 29 | 873 MB |\n| `jupyter/scipy-notebook`  | 21  | 190 | 2.67 GB |\n\n---\n\nNumber of lines in Dockerfile was calculated using all the dockerfiles in the chain with spaces and comments removed.\n\n**Note**: This is not *exactly* a fair comparison because the scipy image from Jupyter Docker Stacks includes so much more (e.g., Conda, JupyterHub, Git, Emacs and more).\n\n# How to Build and Run this Container:\n\n## Build\n\nCurrently, this image is not published to a registry. As a result, you *cannot* use `docker pull` yet. To build the image just run the following from the root directory of this project:\n\n```bash\n\u003e export DOCKER_BUILDKIT=1\n\u003e docker build -t jupyterlab-minimalist:v1 .\n```\nNote: Setting `DOCKER_BUILDKIT` enables [BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/). Although not required, it is recommended because it improves performance, storage and security. \n\n## Run\n\nSuppose you want to work from some directory `/Users/alex/project`. To run with that directory mounted to the container, run:\n\n```bash\n\u003e docker run --rm -it -p 8888:8888 \\\n  -w /home/jordan/work \\\n  --mount type=bind,source=/Users/alex/project,target=/home/jordan/work \\\n  jupyterlab-minimalist:v1\n```\n\n## Include Additional Packages\n\nWant to use ggplot or plotly? Simply modify the `requirements.txt` file and repeat the step in build.\n\n## Using SSL\n\nAssuming you have a generated your certificate and private key file, you can pass these to `jupyter lab` with the following:\n\n```bash\n\u003e docker run --rm -it -p 8888:8888 \\\n  -w /home/jordan/work \\\n  -v /Users/alex/ml-projects:/home/jordan/work \\\n  -v /Users/alex/certs:/home/jordan/certs \\\n  jupyterlab-minimalist:v1 \\\n  --ip=0.0.0.0 --port=8888 \\\n  --certfile=/home/jordan/certs/localhost.cert \\\n  --keyfile=/home/jordan/certs/localhost.key\n```\n\nNote that you have to resend the `ip` and `port` because we are overriding the `CMD` statement with certificate info. There may be a better way to do this but for right now this is the way.\n\nNote, you may have to use `localhost` instead of the `127.0.0.1` if the domain on your generated certificate used `localhost` as the domain (devcert does not support creating certificate authorities with `127.0.0.1`).\n\nSee the [readme in the cert folder](https://github.com/gitjeff05/jupyterlab-minimalist-image/blob/master/cert/app.mjs) for more info on generating self-signed certificates for local development.\n\n## Feedback\n\nAny feedback is most welcome. Please feel free to [open an issue](https://github.com/gitjeff05/jupyterlab-minimalist-image/issues) or pull request if you would like to see any additional functionality or additional kernels added.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitjeff05%2Fjupyterlab-minimalist-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitjeff05%2Fjupyterlab-minimalist-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitjeff05%2Fjupyterlab-minimalist-image/lists"}