> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/de/blog/how-to-fine-tune-llms-with-unsloth-and-docker.md).

# So feinabstimmen Sie LLMs mit Unsloth & Docker

Erfahren Sie, wie Sie LLMs feinabstimmen oder Reinforcement Learning (RL) mit dem Docker-Image von Unsloth durchführen.

Lokales Training kann aufgrund von Dependency-Hölle oder kaputten Umgebungen komplex sein. Unsloths [Docker-Image](https://hub.docker.com/r/unsloth/unsloth) kann diese Probleme umgehen. Es ist keine Einrichtung nötig: Laden Sie das Image herunter, führen Sie es aus und beginnen Sie mit dem Training.

* **Offizielles Unsloth-Docker-Image:** [**`unsloth/unsloth`**](https://hub.docker.com/r/unsloth/unsloth)

**Warum Unsloth & Docker verwenden?**

Unsloths Docker-Image ist stabil, aktuell und funktioniert in [unterstützten Setups](/docs/de/erste-schritte/fine-tuning-for-beginners/unsloth-requirements.md#system-requirements) wie Windows.

* Vollständig enthaltene Abhängigkeiten halten Ihr System sauber. Läuft sicher ohne Root.
* Lokal oder auf jeder Plattform mit vorinstallierten Notebooks verwenden.

{% hint style="success" %}
Sie können jetzt unser Haupt-Docker-Image `unsloth/unsloth` für Blackwell- und 50er-Serie-GPUs verwenden – kein separates Image nötig.
{% endhint %}

### ⚡ Schritt-für-Schritt-Anleitung

{% stepper %}
{% step %}
**Installieren Sie Docker und das NVIDIA Container Toolkit.**

Installieren Sie Docker über [Linux](https://docs.docker.com/engine/install/) oder [Desktop](https://docs.docker.com/desktop/) (sonstiges).\
Dann installieren Sie [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installation):

<pre class="language-bash"><code class="lang-bash"><strong>export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
</strong>sudo apt-get update &#x26;&#x26; sudo apt-get install -y \\
  nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \\
  nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \\
  libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \\
  libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
</code></pre>

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-41cae231ed4761f844ce9836e03b17aabd7c803c%2Fnvidia%20toolkit.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Führen Sie den Container aus.**

[**`unsloth/unsloth`**](https://hub.docker.com/r/unsloth/unsloth) ist Unsloths einziges Docker-Image. Für [Blackwell](/docs/de/blog/fine-tuning-llms-with-blackwell-rtx-50-series-and-unsloth.md) und GPUs der 50er-Serie verwenden Sie dasselbe Image – kein separates Image nötig. Wenn Sie DGX Spark verwenden, müssen Sie unserer [DGX-Anleitung](/docs/de/blog/fine-tuning-llms-with-nvidia-dgx-spark-and-unsloth.md).

```bash
docker run -d -e JUPYTER_PASSWORD="mypassword" \\
  -p 8888:8888 -p 2222:22 \\
  -v $(pwd)/work:/workspace/work \\
  --gpus all \\
  unsloth/unsloth
```

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-2b50d78c5d54eaf189c0a40d46c405585ea23082%2Fdocker%20run.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Greifen Sie auf Jupyter Lab zu**

Gehen Sie zu [http://localhost:8888](http://localhost:8888/) und öffnen Sie Unsloth.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-828df0a668fd94025c1193c24a7f09c1d58dcbd8%2Fjupyter.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Greifen Sie auf die `unsloth-notebooks` Tabs zu, um Unsloth-Notebooks zu sehen.

<div><figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-e7a3f620a3ec5bff335632ff9b0cb422f76528a1%2FScreenshot_from_2025-09-30_21-38-15.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-531882c33eb96dec24e2d7673471d6a3928a3951%2FScreenshot_from_2025-09-30_21-39-41.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Beginnen Sie mit dem Training mit Unsloth**

Wenn Sie neu sind, folgen Sie unserer Schritt-für-Schritt- [Fine-Tuning-Anleitung](/docs/de/erste-schritte/fine-tuning-llms-guide.md), [RL-Anleitung](/docs/de/erste-schritte/reinforcement-learning-rl-guide.md) oder speichern/kopieren Sie einfach eines unserer vorgefertigten [Notebooks](/docs/de/erste-schritte/unsloth-notebooks.md).

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-665f900b008991ddcd8fdabb773b292de3c41e72%2FScreenshot_from_2025-09-30_21-40-29.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

#### 📂 Container-Struktur

* `/workspace/work/` — Ihr gemountetes Arbeitsverzeichnis
* `/workspace/unsloth-notebooks/` — Beispiel-Notebooks für Fine-Tuning
* `/home/unsloth/` — Benutzer-Home-Verzeichnis

### 📖 Verwendungsbeispiel

#### Vollständiges Beispiel

```bash
docker run -d -e JUPYTER_PORT=8000 \\
  -e JUPYTER_PASSWORD="mypassword" \\
  -e "SSH_KEY=$(cat ~/.ssh/container_key.pub)" \\
  -e USER_PASSWORD="unsloth2024" \\
  -p 8000:8000 -p 2222:22 \\
  -v $(pwd)/work:/workspace/work \\
  --gpus all \\
  unsloth/unsloth
```

#### SSH-Schlüssel einrichten

Wenn Sie kein SSH-Schlüsselpaar haben:

```bash
# Neues Schlüsselpaar generieren
ssh-keygen -t rsa -b 4096 -f ~/.ssh/container_key

# Den öffentlichen Schlüssel in docker run verwenden
-e "SSH_KEY=$(cat ~/.ssh/container_key.pub)"

# Per SSH verbinden
ssh -i ~/.ssh/container_key -p 2222 unsloth@localhost
```

### ⚙️ Erweiterte Einstellungen

| Variable           | Beschreibung                                     | Standard  |
| ------------------ | ------------------------------------------------ | --------- |
| `JUPYTER_PASSWORD` | Jupyter-Lab-Passwort                             | `unsloth` |
| `JUPYTER_PORT`     | Jupyter-Lab-Port im Container                    | `8888`    |
| `SSH_KEY`          | Öffentlicher SSH-Schlüssel zur Authentifizierung | `Keine`   |
| `USER_PASSWORD`    | Passwort für `unsloth` Benutzer (sudo)           | `unsloth` |

```bash
-p <host_port>:<container_port>
```

* Jupyter Lab: `-p 8000:8888`
* SSH-Zugriff: `-p 2222:22`

{% hint style="warning" %}
**Wichtig**: Verwenden Sie Volume-Mounts, um Ihre Arbeit zwischen Container-Läufen zu erhalten.
{% endhint %}

```bash
-v <local_folder>:<container_folder>
```

```bash
docker run -d -e JUPYTER_PORT=8000 \\
  -e JUPYTER_PASSWORD="mypassword" \\
  -e "SSH_KEY=$(cat ~/.ssh/container_key.pub)" \\
  -e USER_PASSWORD="unsloth2024" \\
  -p 8000:8000 -p 2222:22 \\
  -v $(pwd)/work:/workspace/work \\
  --gpus all \\
  unsloth/unsloth
```

### **🔒 Sicherheitshinweise**

* Container läuft standardmäßig als Nicht-Root `unsloth` Benutzer
* Verwenden Sie `USER_PASSWORD` für sudo-Operationen innerhalb des Containers
* SSH-Zugriff erfordert die Authentifizierung mit einem öffentlichen Schlüssel


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://unsloth.ai/docs/de/blog/how-to-fine-tune-llms-with-unsloth-and-docker.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
