Wiki
Install Docker
1.Installing Docker Engine on Linux (Recommended)
Linux only needs Docker Engine installed; do not install Docker Desktop, as that thing is specifically for Mac and Windows.
Linux running Docker has very low performance loss, while Windows and macOS running Docker have relatively larger losses.
https://docs.docker.com/engine/install/
https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
1.1.Ubuntu(APT)
The following content is modified based on the official documentation.
If you have installed Docker before, delete it first:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
First install the dependencies and GPG:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo 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.asc
# 如果上面这行报错就弄下面这行
sudo chmod a+r /etc/apt/keyrings/docker.gpg
Trust Docker's GPG public key and add the repository:
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Final installation
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
1.2.Fedora(DNF5)
The following content is adapted from the official documentation. (The official tutorial is still DNF4, which is too old; please see the tutorial below.)
If you have installed Docker before, please delete it first.
sudo dnf remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
Install dependencies, download the repo file, and replace the software repository address with a mirror site:
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
sudo sed -i 's+https://download.docker.com+https://mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
Final installation:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2.Configure the environment
2.1.Check Docker service status :
On Linux, you can check the status of the Docker service with the following command:
systemctl status docker
2.2.Start the Docker service :
If the service is not running, you can use the following command to start the Docker service:
sudo systemctl start docker
2.3.Set Docker to start on boot :
If you want Docker to run automatically every time the system starts, you can enable auto-start on boot:
sudo systemctl enable docker
2.4.Add the user to the docker group:
Use the following command to add the current user to the docker group:
sudo usermod -aG docker $USER
2.5.Log out and log in again :
After executing the above command, you need to log out of the current session and log in again, or run the following command to make the changes take effect:
newgrp docker
2.6.Restart the Docker service (if needed) :
Ensure the Docker service is running. You can use the following command:
sudo systemctl start docker
2.7.After restarting the computer, check the Docker service status :
First restart the computer, and then you can check the status of the Docker service with the following command to see if it is running normally:
sudo reboot
systemctl status docker

3.Install Docker Desktop (Win, Mac)
(Docker Desktop uses a virtual machine on Windows and macOS, resulting in performance loss. It can be used on these two systems, but you need to accept these performance losses. On Windows, the performance loss is almost the same as that of WSL2, because Windows' Docker Desktop is based on WSL2.)
(Docker Desktop on Linux is merely a GUI management tool for Docker Engine, and it still uses Docker Engine by default to start containers, so there is still almost no overhead. Those who dislike using the command line may consider using it.)
Official download and installation:https://www.docker.com/
Docker GPU Passthrough and USB Passthrough on Windows:
To do Nvidia GPU passthrough on Windows, you first need to go to Docker Desktop settings, enable WSL2 support, and check a WSL2 distribution, such as Ubuntu22.04. Next, you need to enter the WSL2 Ubuntu22.04 and install the NVIDIA Container Toolkit. The tutorial is below.
To pass through USB on Docker for Windows, you first need to pass the USB through to WSL2, and then add the device to Docker in the docker run command. (If all WSL2 devices are mounted to Docker, then you only need to pass the USB through to WSL2.)


