---
# System prepended metadata

title: Docker環境部屬

---

# SSH免密碼部屬
```
ssh-keygen
icacls "privateKeyPath" /grant :R


function ssh-copy-id([string]$userAtMachine, $args){   
    $publicKey = "$ENV:USERPROFILE" + "/.ssh/id_rsa.pub"
    if (!(Test-Path "$publicKey")){
        Write-Error "ERROR: failed to open ID file '$publicKey': No such file"            
    }
    else {
        & cat "$publicKey" | ssh $args $userAtMachine "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys || exit 1"      
    }
}


ssh-copy-id wres168@140.118.121.199
```

# 安裝Nvidia Driver
```
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install ubuntu-drivers-common

ubuntu-drivers devices

sudo apt install nvidia-driver-550
sudo reboot
```
# 安裝docker
```
curl -sSL https://get.docker.com/ | sudo sh
```

[Installing the NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-the-nvidia-container-toolkit)

```
sudo usermod -aG docker $USER

sudo systemctl restart docker
sudo reboot
```
# Docker環境部屬

`
sudo docker run --name torch21 --gpus all --shm-size 32g -it -v /home/even1218:/data/ nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 /bin/bash
`

`
sudo docker run --name torch21 --gpus all --shm-size 32g -it -v /home/wres168:/data/ nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 /bin/bash
`


```
apt update
apt install wget git curl vim tmux software-properties-common -y
apt update
apt-add-repository ppa:fish-shell/release-4
apt update
apt install fish -y
chsh -s $(which fish)


curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
fisher install IlanCosman/tide@v5
tide configure
```

.tmux.conf
```
set-option -g mouse on
set-option -g default-shell /usr/bin/fish
```

`cp ./.tmux.conf ~/`

miniconda

```
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init fish

conda create --name torch21 python=3.11  
```

[Pytorch](https://pytorch.org/)

