Skip to content

A step-by-step guide to setting up Docker containers with GPU support for deep learning and computational tasks. Includes instructions for container creation, GPU management, and remote monitoring.

Notifications You must be signed in to change notification settings

ExperienceNotes/Docker-GPU-Setup-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker 使用說明

tags: Tool Docker Server

建立 Docker Image

docker build -f ./Ubuntu22.04-CUDA.Dockerfile -t ubuntu22.04-cuda:latest .
參數 說明
-f 指定 Dockerfile 路徑。
-t 設定 Image 名稱與標籤。

建立 Docker Container

docker run --gpus all --shm-size=8G -d --name container_name -v your_data_path:/workspace -it your_container_name:your_tag

範例:

docker run --gpus all --shm-size=8G -d --name Demo_container -v /data/Yolov9:/workspace -it ubuntu22.04-cuda:yolov9
參數 說明
--gpus 使用 GPU 設定,如 all--gpus 1
--shm-size 設定共享記憶體大小,預設為 64MB,例:--shm-size=8G
-d 背景運行容器。
--name 指定容器名稱。
-v 映射本地資料夾到容器。
-it 進入容器的互動式 shell。
-i 持續打開容器的標準輸入通道,允許互動。
-t 分配虛擬終端進行互動。

進入容器 Shell

docker exec -it container_name bash
參數 說明
-i 保持容器的標準輸入通道打開,允許與 Shell 進行互動。
-t 分配一個模擬終端,提供互動環境。

遠端監控服務器連接

創建遠端 Context

docker context create my_context_name --docker "host=tcp://ip_address:<port>"

範例:

docker context create Ph_server --docker "host=tcp://192.168.1.10:2376"
參數 說明
--docker 指定要連接的 Docker 配置。
host=tcp://ip_address:<port> 指定遠端 Docker 的 IP 地址和連接埠。

使用遠端 Context

docker context use context_name

範例:

docker context use Ph_server

參考

About

A step-by-step guide to setting up Docker containers with GPU support for deep learning and computational tasks. Includes instructions for container creation, GPU management, and remote monitoring.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published