Skip to content

UmairShah7677/Docker-Cuda-Installation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Here's a README file structure for setting up Docker and running a Docker container, step-by-step:


Docker Setup and Container Run Guide

Installation of Docker on Ubuntu

  1. Update Your System:

    sudo apt update && sudo apt upgrade -y
    
  2. Install Required Packages:

    sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
    
  3. Add Docker's Official GPG Key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    
  4. Set Up the Stable Repository:

    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
  5. Install Docker Engine:

    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io -y
    
  6. Verify Installation:

    sudo docker run hello-world
    

Running Docker Container

  1. Navigate to the Project Directory:

    cd path/to/your/dockerfile
    
  2. Build the Docker Image:

    docker build -t your-image-name .
    
  3. Run the Docker Image:

    docker run -it your-image-name
    

CUDA Environment Docker Setup

Prerequisites

  • Ubuntu machine with Docker installed
  • NVIDIA GPU with appropriate drivers installed on the host system

Installation Steps

  1. Clone the Repository:

    • Clone or download the repository containing the Dockerfile:
      git clone https://github.com/UmairShah7677/Docker-Cuda-Installation
      cd Docker-Cuda-Installation
      
  2. Build the Docker Image:

    • Navigate to the directory containing the Dockerfile and build the image:
      docker build -t cud-env .
      
  3. Run the Docker Container:

    • Start a Docker container using the built image:
      docker run -it --gpus all cud-env
      

Dockerfile Breakdown

Here's a brief overview of what each command in the Dockerfile does:

  • Wget: Downloads the CUDA repository pin and Debian package.
  • mv: Moves the pin file to set priority for the CUDA packages.
  • dpkg: Installs the CUDA repository Debian package.
  • cp: Copies the keyring to the designated folder to validate packages.
  • apt-get update: Updates the package list.
  • apt-get install: Installs the CUDA toolkit and drivers.

Additional Configuration

  • Environment Variables:
    • Add CUDA to the PATH and LD_LIBRARY_PATH environment variables:
      export PATH=/usr/local/cuda/bin:$PATH
      export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
      
  • Tools:
    • Install any additional tools like vim or screenfetch if needed:
      apt-get install -y vim screenfetch
      

Troubleshooting

  • Docker Build Errors:
    • Ensure there are no syntax errors in the Dockerfile, especially around command chaining (&& \).
    • Check that all URLs and file paths are correct and accessible.

For more detailed information, check official NVIDIA and Docker documentation.


This README provides a clear step-by-step guide to setting up a Docker container for CUDA work, tailored to the specific commands and environment you are working with.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published