Intelligente Lösungen
in neuer Dimension

Docker und Ubuntu-18.04

Hier beschreibe ich die Verwendung von Docker unter Ubuntu-18.04. Ich verwende die offiziell von Ubuntu unterstützte Docker-Version.

System aktualisieren

1
2
sudo apt-get update
sudo apt-get dist-upgrade

Docker installieren

1
2
sudo apt-get install docker.io
# Installiert u.a. "docker.io amd64 18.09.2-0ubuntu1~18.04.1"

Danach: Test, ob Docker läuft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
uli@ulivaio:~/git/dp-octopress/source/_posts$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-05-15 10:30:54 CEST; 31s ago
     Docs: https://docs.docker.com
 Main PID: 7967 (dockerd)
    Tasks: 34
   CGroup: /system.slice/docker.service
           ├─7967 /usr/bin/dockerd -H fd://
           └─8007 docker-containerd --config /var/run/docker/containerd/containerd.toml --log-level info

Mai 15 10:30:53 ulivaio dockerd[7967]: time="2019-05-15T10:30:53.646065184+02:00" level=warning msg="Your kernel does not support swap memory limit"
Mai 15 10:30:53 ulivaio dockerd[7967]: time="2019-05-15T10:30:53.646243714+02:00" level=warning msg="Your kernel does not support cgroup rt period"
Mai 15 10:30:53 ulivaio dockerd[7967]: time="2019-05-15T10:30:53.646288000+02:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Mai 15 10:30:53 ulivaio dockerd[7967]: time="2019-05-15T10:30:53.647513602+02:00" level=info msg="Loading containers: start."
Mai 15 10:30:53 ulivaio dockerd[7967]: time="2019-05-15T10:30:53.930711295+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip 
Mai 15 10:30:54 ulivaio dockerd[7967]: time="2019-05-15T10:30:54.028985746+02:00" level=info msg="Loading containers: done."
Mai 15 10:30:54 ulivaio dockerd[7967]: time="2019-05-15T10:30:54.118204664+02:00" level=info msg="Docker daemon" commit=6247962 graphdriver(s)=overlay2 version=18.09.2
Mai 15 10:30:54 ulivaio dockerd[7967]: time="2019-05-15T10:30:54.118469534+02:00" level=info msg="Daemon has completed initialization"
Mai 15 10:30:54 ulivaio dockerd[7967]: time="2019-05-15T10:30:54.153116770+02:00" level=info msg="API listen on /var/run/docker.sock"
Mai 15 10:30:54 ulivaio systemd[1]: Started Docker Application Container Engine.

Docker ohne SUDO

1
2
3
4
sudo usermod -aG docker ${USER}
# Abmelden und wieder anmelden
# Nachkontrolle - muß "docker" ausgeben
id ${USER}|grep -o docker

Erster Docker-Container

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
uli$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:5f179596a7335398b805f036f7e8561b6f0e32cd30a32f5e19d17a3cda6cc33d
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/