Skip to content

simple setup of docker container for jupyter notebooks

Notifications You must be signed in to change notification settings

martinzrrl/docker-jpynb-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequesits

  • Docker installed
  • Jupyter installed

1 Build image

Required files to build the image:

  • Dockerfile
  • requirements.txt
docker build -t <name of image> .

2 Run jupyter image

Run built image with command

docker run -it --name <name of container> -p 8888:8888 <name image>

if there is no local image with the name, the Docker daemon searches and downloads image e.g. "jupyter/base-notebook" from Docker hub

3 Run Jupyter notebook

run Jupyter notebook e.g. through VS Code or in browser with http://localhost:8888/
(enter server ID / token, which is in Terminal output when container is started, is needed)

  • interaction between container and jupyter notebooks
  • new libraries can be installed either on
    • image, rebuild of image and container required
    • container, with jupyter notebook

4 Restart container next time

(1) restart container

docker start <containerID e.g. from Docker Desktop>

(2) get Jupyter URL from logs

docker logs <containerID e.g. from Docker Desktop>

(3) use Jupyter notebook with libraries

5 Optional: Dev containers

usage

  • develop and execute code inside a container
  • the file devcontainer.json tells the VS Code Dev Container extension how to create and access Dev Containers

commandpalette

  • Dev Containers: Add Dev Container Configuration Files creates a new devcontainer.json template file and an optional Dockerfile, which both can be further adjusted
  • Dev Containers: New Dev Container builds and starts new Dev container
  • Dev Containers: Rebuild and Reopen in Container

Remarks

About

simple setup of docker container for jupyter notebooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published