# Docker, Docker-Compose und Portainer installieren

<p class="callout info">Weitere Infos zu Docker: [Docker Einführung](https://wiki.hhml.selfhost.co/books/linux/page/docker-einfuhrung "Docker Einführung")</p>

```
sudo apt update && sudo apt upgrade -y
```

## Docker Installation auf Ubuntu

Führe folgende Befehle als root bzw. mit sudo aus:

1. Alle alten Docker-Pakete entfernen (optional, falls vorher installiert):
    
    
    1. ```
        sudo apt-get remove docker docker-engine docker.io containerd runc
        ```
2. Installationsskript herunterladen und ausführbar machen:
    
    <div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl flex h-0 items-start justify-end md:sticky md:top-[100px]">  
    </div><div class="-mt-xl"><div>`curl -fsSL https://get.docker.com -o get-docker.shchmod +x get-docker.sh`</div></div></div></div>
3. Docker installieren:
    
    <div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl flex h-0 items-start justify-end md:sticky md:top-[100px]"><div class="overflow-hidden rounded-full border-subtlest ring-subtlest divide-subtlest bg-base">  
    </div></div><div class="-mt-xl"><div>`sudo sh ./get-docker.sh`</div></div></div></div>
4. Docker-Status prüfen:
    
    <div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl flex h-0 items-start justify-end md:sticky md:top-[100px]"><div class="overflow-hidden rounded-full border-subtlest ring-subtlest divide-subtlest bg-base">  
    </div></div><div class="-mt-xl"><div>`sudo systemctl status docker`</div></div></div></div>

Du kannst die Gruppenrechte für deinen User noch anpassen, um Docker ohne sudo verwenden zu können:

<div class="w-full md:max-w-[90vw]" id="bkmrk-sudo-usermod--ag-doc"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="translate-y-xs -translate-x-xs bottom-xl mb-xl flex h-0 items-start justify-end md:sticky md:top-[100px]"><div class="overflow-hidden rounded-full border-subtlest ring-subtlest divide-subtlest bg-base">  
</div></div><div class="-mt-xl"><div>`sudo usermod -aG docker $USER`</div></div></div></div>Danach ab- und neu anmelden.

## <s>Docker Compose Installation</s>

Empfohlen wird das aktuelle Compose-Plugin via apt oder als Binary:

**Variante 1: Über das Docker Compose Plugin (apt-basiert):**

1. Repository aktualisieren:
    
    <div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="-mt-xl"><div>`sudo apt-get updatesudo apt-get install docker-compose-plugin`</div></div></div></div>
2. Installation prüfen:
    
    <div class="w-full md:max-w-[90vw]"><div class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"><div class="-mt-xl"><div>`docker compose version`</div></div></div></div>

## 4. Portainer installieren

```
docker volume create portainer_data
```

```
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
```

Fertig!

<div class="page-content" id="bkmrk-version-%237-erstellt%3A"><div dir="auto">  
</div>---

<div class="text-muted text-small"><div class="entity-meta"><svg class="svg-icon" data-icon="history" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> </svg>Version #7   
<svg class="svg-icon" data-icon="star" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> </svg>Erstellt: 19 October 2022 08:30:05 von hermann   
<svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> </svg>Zuletzt aktualisiert: 2 November 2022 10:08:43 von hermann</div></div></div>