From 708643b60c77df37bd74881c45090907efd1fe83 Mon Sep 17 00:00:00 2001 From: Christoph Schranz Date: Tue, 14 Jul 2020 17:11:06 +0200 Subject: [PATCH] updated to non-docker-compose build and run --- .build/Dockerfile | 1 + README.md | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.build/Dockerfile b/.build/Dockerfile index 596360e..fa03214 100755 --- a/.build/Dockerfile +++ b/.build/Dockerfile @@ -5,6 +5,7 @@ FROM nvidia/cuda:10.1-base-ubuntu18.04 LABEL maintainer="Christoph Schranz " # This is a concatenated Dockerfile, the maintainers of subsequent sections may vary. +RUN chmod 1777 /tmp && chmod 1777 /var/tmp ############################################################################ #################### Dependency: jupyter/base-image ######################## diff --git a/README.md b/README.md index b1ed4c8..0662083 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The image of this repository is available on [Dockerhub](https://hub.docker.com/ The CUDA toolkit is not required on the host system, as it will be deployed in [NVIDIA-docker](https://github.com/NVIDIA/nvidia-docker). You can be sure that you can access your GPU within Docker, - if the command `docker run --runtime nvidia nvidia/cuda:10.1-base-ubuntu18.04 nvidia-smi` + if the command `docker run --gpus all nvidia/cuda:10.1-base-ubuntu18.04 nvidia-smi` returns a result similar to this one: ```bash Mon Jun 22 09:06:28 2020 @@ -58,19 +58,31 @@ The image of this repository is available on [Dockerhub](https://hub.docker.com/ ## Quickstart -First of all, it is necessary to generate the `Dockerfile` based on the +First of all, it is necessary to generate the `Dockerfile` based on the NIVIDA base image and the [docker-stacks](https://github.com/jupyter/docker-stacks). As soon as you have access to your GPU within Docker containers -(make sure the command `docker run --runtime nvidia nvidia/cuda:10.1-base-ubuntu18.04 nvidia-smi` shows your -GPU statistics), you can generate a Dockerfile and build it via docker-compose. -The two commands will start *GPU-Jupyter* on [localhost:8848](http://localhost:8848) with the default +(make sure the command `docker run --gpus all nvidia/cuda:10.1-base-ubuntu18.04 nvidia-smi` shows your +GPU statistics), you can generate a Dockerfile, build and run it. +The following commands will start *GPU-Jupyter* on [localhost:8848](http://localhost:8848) with the default password `asdf`. ```bash - ./generate-Dockerfile.sh - ./start-local.sh -p 8848 # where -p stands for the port, default 8888 + ./generate_Dockerfile.sh + docker build -t gpu-jupyter .build/ # will take a while + docker run -d -p [port]:8888 gpu-jupyter # starts gpu-jupyter WITHOUT GPU support ``` +To run the container with GPU support, a local data volume and , run: + ```bash +docker run -d -it --rm --gpus all -p [JUPYTER_PORT]:8888 -v ./data:/home/jovyan/work -e GRANT_SUDO="yes" -e JUPYTER_ENABLE_LAB="yes" gpu-jupyter + ``` + +Or on windows: + ```bash +docker run -d -it --rm --gpus all -p [JUPYTER_PORT]:8888 -v /${PWD}/data:/home/jovyan/work -e GRANT_SUDO="yes" -e JUPYTER_ENABLE_LAB="yes" gpu-jupyter + ``` + + ## Parameter The script `generate-Dockerfile.sh` has multiple parameters: