Added docker setup
This commit is contained in:
parent
75c61ee2f3
commit
5f6d1a4bee
|
@ -0,0 +1,62 @@
|
||||||
|
<a href="../../../Readme.md">
|
||||||
|
<img src="../../../common/back_arrow.png" alt="50" width="50"/>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
# DOCKER - Setup (Ubuntu)
|
||||||
|
|
||||||
|
### Docker engine and compose setup
|
||||||
|
|
||||||
|
1. Set up the Docker's apt repository:
|
||||||
|
```console
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install ca-certificates curl gnupg
|
||||||
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||||
|
|
||||||
|
echo \
|
||||||
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||||
|
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
sudo apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the latest version of Docker:
|
||||||
|
```console
|
||||||
|
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Add the local user to the Docker group:
|
||||||
|
```console
|
||||||
|
sudo usermod -aG docker $USER
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Nvidia container toolkit setup
|
||||||
|
The [Nvidia container toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) is needed to use the GPU inside a Docker container. To setup:
|
||||||
|
1. Configure the repository (notice that **curl** must be installed on the system):
|
||||||
|
```console
|
||||||
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
||||||
|
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
||||||
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \
|
||||||
|
&& \
|
||||||
|
sudo apt-get update
|
||||||
|
```
|
||||||
|
2. Install the Nvidia Containter Toolkit packages
|
||||||
|
```console
|
||||||
|
sudo apt-get install -y nvidia-container-toolkit
|
||||||
|
```
|
||||||
|
3. Configure the container runtime for Docker:
|
||||||
|
```console
|
||||||
|
sudo nvidia-ctk runtime configure --runtime=docker
|
||||||
|
sudo systemctl restart docker
|
||||||
|
```
|
||||||
|
4. Give docker full access to the X server:
|
||||||
|
```console
|
||||||
|
sudo nano ~/.xprofile
|
||||||
|
```
|
||||||
|
Add the following line at the end of the file, then save (CTRL+O):
|
||||||
|
```console
|
||||||
|
xhost +local:docker > /dev/null 2>&1
|
||||||
|
```
|
Loading…
Reference in New Issue