Docker-CE: Get Started Tutorial - processes / files / HTTP headers

Inside my docker installation on ubuntu server i performed the official docker tutorial part 2: "containers"

Ok. Not really interesting, because the tutorial describes all steps very well (except the point, that you have to install python3-pip and you have to run pip3 and not pip).

Here the interesting part:

After i started the container ("docker run -p 4000:80 friendlyhello") i got the following:
root@ubuntuserver:/var/lib/docker/image# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
6f187950452f        friendlyhello       "python app.py"     2 hours ago         Up 2 hours>80/tcp   keen_bartik
and the OS displayed

root@ubuntuserver:/var/lib/docker/image# ps x |grep docker
 5852 ?        Ssl    0:18 /usr/bin/dockerd -H fd://
 5867 ?        Ssl    0:10 docker-containerd --config /var/run/docker/containerd/containerd.toml
17100 ?        Sl     0:00 /usr/bin/docker-proxy -proto tcp -host-ip -host-port 4000 -container-ip -container-port 80
17105 ?        Sl     0:00 docker-containerd-shim --namespace moby --workdir /var/lib/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/6f187950452f501cf18d7efd673e8305d6c9752c58acfb14918ae37341952a11 --address /var/run/docker/containerd/docker-containerd.sock --runtime-root /var/run/docker/runtime-runc
So the containerid is part of the directory which is loaded with "--workdir"

The HTTP headers showup the following:

So the process "docker-proxy-proto" does only a portforwarding from port 4000 to port 80 and the webserver is provided by python:
Content-Type: text/html; charset=utf-8
Content-Length: 118
Server: Werkzeug/0.12.2 Python/2.7.14
Date: Sun, 19 Nov 2017 12:20:42 GMT
Here the process tree:
# pstree -al
  ├─dockerd -H fd://
  │   ├─docker-containe --config /var/run/docker/containerd/containerd.toml
  │   │   ├─docker-containe --namespace moby --workdir /var/lib/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/6f187950452f501cf18d7efd673e8305d6c9752c58acfb14918ae37341952a11 --address /var/run/docker/containerd/docker-containerd.sock --runtime-root /var/run/docker/runtime-runc
  │   │   │   ├─python app.py
  │   │   │   └─9*[{docker-containe}]
  │   │   └─7*[{docker-containe}]
  │   ├─docker-proxy -proto tcp -host-ip -host-port 4000 -container-ip -container-port 80
  │   │   └─4*[{docker-proxy}]
  │   └─9*[{dockerd}]
Note that this container has the ip This is part of a private network and the ubuntu server has the ip
# ip address show docker0
3: docker0: mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:f4:04:06:3d brd ff:ff:ff:ff:ff:ff
    inet scope global docker0
       valid_lft forever preferred_lft forever

If you start the container twice
root@ubuntuserver:~/dockerapp# docker run -d -p 4000:80 friendlyhello
root@ubuntuserver:~/dockerapp# docker run -d -p 4001:80 friendlyhello
there are two docker-proxies running:
# ps aux|grep docker-proxy
root      1286  0.0  0.3 304928  3084 ?        Sl   16:16   0:00 /usr/bin/docker-proxy -proto tcp -host-ip -host-port 4000 -container-ip -container-port 80
root      1385  0.0  0.2 304928  2880 ?        Sl   16:16   0:00 /usr/bin/docker-proxy -proto tcp -host-ip -host-port 4001 -container-ip -container-port 80

Keine Kommentare:

Kommentar veröffentlichen