Docker Grundinstallation Debian/Ubuntu

Serververwaltung mit Salt Stack, Logging und Monitoring mit ELK-Stack und TIG-Stack
Antworten
Benutzeravatar
h3rb3rn
Administrator
Beiträge: 151
Registriert: vor 4 Jahre

Docker Grundinstallation Debian/Ubuntu

Beitrag von h3rb3rn » vor 7 Monate

aktualisierte Fassung vom 21.12.2018

Quelle: https://docs.docker.com/install/linux/d ... repository

Für Debian:

Code: Alles auswählen

apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Code: Alles auswählen

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Code: Alles auswählen

apt-key fingerprint 0EBFCD88

Code: Alles auswählen

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Code: Alles auswählen

apt update && apt install docker-ce


Bezugsquelle für fertige Docker Container: https://hub.docker.com/


Docker Container über Dockerhub beziehen
docker pull $dockercontainer$
Beispiel

Code: Alles auswählen

docker pull nginx


Docker Installation testen

Code: Alles auswählen

docker run hello-world
# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1***2****c****0*: Pull complete
Digest: sha256:**************d*************6****************7*************
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/
Docker Prozesse anzeigen lassen

Code: Alles auswählen

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
*****e*******8******** hello-world "/hello" 18 seconds ago Exited (0) 16 seconds ago heuristic_mccarthy
**a******4******1***** nginx "-d -p 80" 3 minutes ago Created 80/tcp upbeat_banzai
***c*****1****5******* nginx "nginx -g 'daemon of…" 4 minutes ago Exited (0) 4 minutes ago happy_elgamal


Docker Container starten

Quelle: https://www.digitalocean.com/community/ ... untu-14-04

Code: Alles auswählen

sudo docker run --name docker-nginx -p 80:80 -d nginx


Docker Container stopen

Code: Alles auswählen

docker stop docker-nginx && docker rm docker-nginx


Docker Kommando Übersicht unter https://docs.docker.com/engine/reference/commandline/

Link:
BBcode:
HTML:
Hide post links
Show post links

Antworten