container
August 3, 2022 ยท View on GitHub
Scripts to help instantiate docker containers with GPU acceleration and python deep learning frameworks.
1. Install Docker
Run:
bash setup/dockerinstall.sh
Give to docker sudo permissions:
bash setup/dockersudo.sh
To get docker with GPU support run (nvidia-docker2):
bash setup/nvidiadocker.sh
For any issue regarding nvidia-docker please refer to the official page.
2. Build and run containers
To get custom container running on your home directory:
bash build.sh -n ContainerNameYouPrefer -f DockerfileYouDefined -i DeepLearningFrameworkImageName -r RequirementsFileName
bash run.sh -n ContainerNameYouPrefer
Please notice that RequirementsFileName must be a path in the current docker context (current build folder - cd ./).
Examples
To get container with latest Tensorflow and GPU support running on your home directory:
bash main.sh
Use different frameworks version
Visit docker hub, search for the framework and select the tag corresponding the version you need (e.g. visit tensorflow of pytorch). Then replace the name in the DeepLearningFrameworkImageName, e.g. if you want to pass to 2.8.0-gpu-jupyter version, change this:
bash build.sh -i tensorflow/tensorflow:latest-gpu-jupyter
into this:
bash build.sh -i tensorflow/tensorflow:2.8.0-gpu-jupyter
How to use in projects
You can define a requirements.txt file in YourProjectFolder and run:
cd YourProjectFolder/
bash container/main.sh # this will automatically search for requirements.txt file in the current docker context (YourProjectFolder)