Set up a GPU accelerated Docker container using Lambda Stack + Lambda Stack Dockerfiles on Ubuntu 20.04 LTS
(Updated on )
• 2 min read
Or, how Lambda Stack + Lambda Stack Dockerfiles = GPU accelerated deep learning containers
Accelerated Docker Containers with GPUs!
Ever wonder how to build a GPU docker container with TensorFlow or PyTorch in it? In this tutorial, we'll walk you through every step. We provide Dockerfiles for 20.04, 18.04, and 16.04 for the container OS. This tutorial should work for both 20.04 LTS and 18.04 LTS host systems.
5) Upload your container image to a container registry
sudo docker login
sudo docker tag lambda-stack myusername/lambda-stack:20.04
sudo docker push myusername/lambda-stack:20.04# You can now run the above command on any new computer after installing Lambda Stack, docker.io, and the nvidia-container-runtime like this:
sudo docker run --gpus 1 --rm --interactive --tty myusername/lambda-stack:latest /usr/bin/python3 -c 'import torch; print(torch.rand(5, 5).cuda()); print("I love Lambda Stack!")'
Voilà. You're now up and running with a Lambda Stack Docker image. Furthermore, you now have a Docker image hosted on your container registry that you control.
If you have any questions about using Lambda Stack Dockerfiles, email software@lambdalabs.com.