Zum Hauptinhalt springen

Installation Docker

Voraussetzungen installieren

# update packages
sudo apt-get update
# install required packages
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# add GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# add stable repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Docker installieren

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

docker-compose installieren

# Version install
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# latest version
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Docker testen

# run hello world image
sudo docker run hello-world
# delete image
sudo docker image rm hello-world --force

Benutzer zur Docker Gruppe hinzufügen

Für eine spätere einfachere Handhabung mit Docker, empfiehlt es sich, den Benutzer mit dem man arbeitet der docker Gruppe hinzuzufügen.

# add user to group
sudo usermod -aG docker ubuntu
# restart system
sudo rm -fr /var/run/docker.sock && sudo reboot

https://docs.docker.com/engine/install/ubuntu/

https://docs.docker.com/compose/install/


Kommentare