{"id":25239455,"url":"https://github.com/mr-talhailyas/setting-up-deep-learning-server-docker","last_synced_at":"2026-05-01T14:31:43.465Z","repository":{"id":37640731,"uuid":"477993735","full_name":"Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker","owner":"Mr-TalhaIlyas","description":"Build your own Deep Learning Server via Docker","archived":false,"fork":false,"pushed_at":"2024-07-23T00:26:04.000Z","size":1255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T19:43:31.821Z","etag":null,"topics":["custom-docker-ml-images","custom-dockerfiles","deep-learning","docker","docker-containers","docker-deep-learning","docker-images","docker-tensorflow","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mr-TalhaIlyas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-05T05:55:37.000Z","updated_at":"2024-07-23T00:26:08.000Z","dependencies_parsed_at":"2025-02-11T18:43:57.758Z","dependency_job_id":null,"html_url":"https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mr-TalhaIlyas","download_url":"https://codeload.github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-docker-ml-images","custom-dockerfiles","deep-learning","docker","docker-containers","docker-deep-learning","docker-images","docker-tensorflow","machine-learning"],"created_at":"2025-02-11T18:28:06.537Z","updated_at":"2026-05-01T14:31:43.430Z","avatar_url":"https://github.com/Mr-TalhaIlyas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setting-up-Deep-Learning-Server-Docker\n\n[![Linux](https://svgshare.com/i/Zhy.svg)](https://svgshare.com/i/Zhy.svg) [![made-with-bash](https://img.shields.io/badge/Made%20with-Bash-1f425f.svg)](https://www.gnu.org/software/bash/) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FMr-TalhaIlyas%2FSetting-up-Deep-Learning-Server-Docker\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n\n# Contents\n\n* Setting Up Deep Learning Server Docer\n* [Build Custom ML Docker Images](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/build_docker_image.md).\n* [Useful Docker Commands](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/useful_docker_cmds.md).\n* Uninstall Docker\n\n# Setting-Up-Deep-Learning-Server-Docker\nfor setting deep learning server via Anaconda go [here](https://github.com/Mr-TalhaIlyas/Setting-Up-Deep-Learning-Server-Anaconda)\nAssuming that you already have a machine runnning Linux/Ubuntu.\n\n## 1. Install GPU drivers\n\n1st type the following command to get the list of recommended drivers for your PC.\n\n```\nubuntu-drivers devices\n```\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-Up-Deep-Learning-Server-Anaconda/blob/main/Pictures/s1.png)\n\nNow install GPU drivers. I will install 470v drivers as shown in above images, so lets proceed.\n\n```\n// Update repository.  \n$ sudo add-apt-repository ppa:graphics-drivers/ppa  \n$ sudo apt update  \n\n// Check recommeded driver can be used.  \n$ apt-cache search nvidia | grep nvidia-driver-470 \n```\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-Up-Deep-Learning-Server-Anaconda/blob/main/Pictures/s2.png)\n\nNow lets install drivers using APT\n\n```\n// Install driver by apt.  \n$ sudo apt-get install nvidia-driver-470  \n\n// Reboot.  \n$ sudo reboot  \n```\n\n※ During NVIDIA installation process if an error occurs or you can't proceed or you can't get your desired vesion to be displayes or run you have to uninstall it completelyl by\n\n```\n$ sudo apt --purge autoremove nvidia*\n```\nafter installation verify it by\n\n```\nnvidia-smi\n```\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-Up-Deep-Learning-Server-Anaconda/blob/main/Pictures/s3.png)\n\n## 2. Install Docker\n\nWhen you are setting up a deep learning server you don't have to install Nvidia CUDA Toolkit. As different version of libraries require differnt versions of CUDA and cuDNN toolkits installed. Docker has advantage that when we run a specific image of a specific version of a library all of its dependencies ,like DL SDK, CUDA toolkit, are automatically installed within that isolated container. For details [here](https://docs.nvidia.com/deeplearning/frameworks/user-guide/index.html)\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/nvidia1.png)\n\n[image source](https://docs.nvidia.com/deeplearning/frameworks/user-guide/index.html)\n\n\n**`Installing Docker`**\n\nIf you have any previous or broken installation of docker then remove it first by following steps here [uninstall docker](#uninstall-docker).\n\nThe detailed steps for installing docker via different methods on `Linux` are listed [here](https://docs.docker.com/engine/install/ubuntu/). I'll be using [`Install using repository`](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) method listed there.\n\nI'll be installing the latest version of Docker available, currently whihc is `5:20.10.14~3-0~ubuntu-bionic`.\nAfter you have completed the installation check the installation and version via\n```\n$ sudo docker version\n```\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/docker_v.png)\n\n```\n$ sudo docker run docker/whalesay cowsay hello to the world of docker\n```\nand you'll semething like\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/hello_docker.png)\n\nNotice the yellow highlighted area that the container `whalesay` wasn't available on your local machine. So the docker automatically dowloaded it from the official docker hub.\n\n## Post-Installation Steps on Linux for Conveninece\nNotice that in the above commands we had to use `sudo` just for checking version installed and printing `docker hello world`. Docker will always need root permission. So to give it root permisison by default follow the steps below.\n\n```\n//creat new docker group\n$  sudo groupadd docker\n// you might see,\n//groupadd: group 'docker' already exists\n// but continue anyway\n\n// here i'll replace $USER with my username i.e, talha\n$  sudo usermod -aG docker $USER\n\n// to activate groupchanges\n$ newgrp docker \n\n// now test it, without sudo\n$ docker run docker/whalesay cowsay hello to the world of docker\n```\n## 3. Install Nvidia Container Toolkit\nLets first install `NVIDIA Container Toolkit` whihc will allows us to build and run GPU accelerated Docker containers liek TF/Torch. Details for installation can be found [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker). But I'll just summarize them below.\n\nSetup the package repository and the GPG key:\n```\n$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \\\n      \u0026\u0026 curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - \\\n      \u0026\u0026 curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list\n```\nNow install `nvidia-docker2` package\n\n```\n$ sudo apt-get update\n\n$ sudo apt-get install -y nvidia-docker2\n\n// Restart the Docker daemon to complete the installation after setting the default runtime:\n$ sudo systemctl restart docker\n```\nand you are done installing nvidia container. We haven't installed any specific `CUDA` or `cuDNN` toolkit here. Those will be automatically installed when we will install a specific version of our desired library.\n\n## 4. Installing Deep Learning Libraries (Tensorflow/Pytorch)\n\nWe'll install here `tensorflow-gpu` first.\n1. [Official TF Guide](https://www.tensorflow.org/install/docker)\n2. [Docker TF Hub](https://hub.docker.com/r/tensorflow/tensorflow/)\n\n\nGo [here](https://hub.docker.com/r/tensorflow/tensorflow/tags) and select your desired `tf` version. Just like `conda` needs you to specify the vesion of lib to be installed like `conda install lib_name==0.1.3` etc. Docker uses tags to specify the versions to be installed.\n\nWe will install `tensorflow-gpu==2.3.0` here. So type in the following command. The parameter `--gpys all` is important without it the gpus will not be detected by the container.\n\n```\n$ docker run --gpus all -it --rm tensorflow/tensorflow:2.3.0-gpu\n```\n\nOnce you run above command you'll see\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/tf3.png)\n\nMoreover you'll see that after running the above command now you're inside a completely isolated container. As this \n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/b.png)\n\nchange to this\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/r.png)\n\nNow while inside container you can check your isntallation via\n\n```\n// type this while insed container\n$ python\n\n// you'll enter python now\n\u003e\u003e\u003eimport tensorflow as tf\n\u003e\u003e\u003etf.config.list_physical_devices('GPU')\n```\nYou'll see following output.\n\n![alt text](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/screens/tf3_op.png)\n\n## 5. Installing `pip` libraries.\n\nDefinately you don't only need the `tf` to develope you ML models. YOu need other libraries like `opencv`, `imutils` etc. So while inside this container you can install these libraries via `pip` as you'd ususally do.\n\n```\n$ pip install fmutils\n$ pip install \u003cname of lib\u003e\n```\n*Step 4.* [Exiting Container](#issues)\n\nTo exit container press `Ctrl` + `P` + `Q`\n\nIf you have entered python inside container then first press `Ctrl` + `Z`.\n\n⚠ **Every time you exit container all of your installed libs/packages will also be destroyed as the containers don't hold any data or any OS. They only exist as long as the process inside them is running after that they are destroyed and every time you run the command for `docker run` a completely new docker container in created.** ⚠\n\nSo its better to create Docker custom image files using `Docker build` so that you can load your own custom containers with all the dependencides installed.\n\nI have already build one container for that [here](https://hub.docker.com/r/talhailyas/tf)\n\n```\ndocker pull talhailyas/tf\n```\n\nFor that follow the steps mentioned here **[Build Custom ML Docker Images](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/build_docker_image.md)**.\n\nFor other useful docker commands go here **[Useful Docker Commands](https://github.com/Mr-TalhaIlyas/Setting-up-Deep-Learning-Server-Docker/blob/main/useful_docker_cmds.md)**.\n\n\n\n\n\n\n\n# \u003ca name=\"uninstall-docker\"\u003eUninstalling Docker\u003c/a\u003e\n\nFor complete removel\n\n```cli\n$ dpkg -l | grep -i docker\n\n$ sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli\n\n$ sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce\n```\nImages, containers, volumes, or user-created configuration files on your host will not be removed by the above instructions. Run the following commands to delete all images, containers, and volumes:\n\n```cli\n$ sudo rm -rf /var/lib/docker /etc/docker\n$ sudo rm /etc/apparmor.d/docker\n$ sudo groupdel docker\n$ sudo rm -rf /var/run/docker.sock\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-talhailyas%2Fsetting-up-deep-learning-server-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-talhailyas%2Fsetting-up-deep-learning-server-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-talhailyas%2Fsetting-up-deep-learning-server-docker/lists"}