examples: add the example from projects/logging

This simplifies the example by adding a service which writes to the
log every 1s and a getty for introspection.

To see the logs:

  /proc/1/root/usr/bin/logread -F

Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
David Scott 2018-07-01 12:11:00 +01:00
parent a07ecf60d5
commit 92a9a64a1b
2 changed files with 30 additions and 33 deletions

30
examples/logging.yml Normal file
View File

@ -0,0 +1,30 @@
# Simple example of using an external logging service
kernel:
image: linuxkit/kernel:4.14.53
cmdline: "console=tty0 console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:4fa16c9045d60732dadb04f5d7f5c18d83c6551e
- linuxkit/runc:v0.4
- linuxkit/containerd:f2bc1bda1ab18146967fa1a149800aaf14bee81b
- linuxkit/ca-certificates:v0.4
- linuxkit/memlogd:883f0d46e7d3ae2d787e8acb496da115a4707cbc
onboot:
- name: sysctl
image: linuxkit/sysctl:v0.4
- name: dhcpcd
image: linuxkit/dhcpcd:v0.4
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
# Inside the getty type `/proc/1/root/usr/bin/logread -F` to follow the log
- name: getty
image: linuxkit/getty:44730fd0a7c59dbacf5b48b54ba33f551bcf7ef0
env:
- INSECURE=true
# A service which generates log messages for testing
- name: write-to-the-logs
image: alpine
command: ["/bin/sh", "-c", "while /bin/true; do echo hello $(date); sleep 1; done" ]
trust:
org:
- linuxkit
- library

View File

@ -1,33 +0,0 @@
kernel:
image: linuxkit/kernel:4.14.53
cmdline: "console=ttyS0 console=tty0 page_poison=1"
init:
- linuxkit/init:0e4af96fecc8f752c80d41c0b7d06570cc1dc6b2
- linuxkit/runc:v0.4
- linuxkit/containerd:27a4c84cc8fab2d5ea04342546ecd20453ec99b3
- linuxkit/ca-certificates:v0.4
- linuxkit/memlogd:4c16d6720075bcb2aeb298a8ee2d08d74aa20512
onboot:
- name: sysctl
image: linuxkit/sysctl:v0.4
- name: dhcpcd
image: linuxkit/dhcpcd:1fe0db6b1eb7bcb1e4823e61e08afe6d48af7d16
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
- name: rngd
image: linuxkit/rngd:v0.4
- name: nginx
image: nginx:1.13.8-alpine
capabilities:
- CAP_NET_BIND_SERVICE
- CAP_CHOWN
- CAP_SETUID
- CAP_SETGID
- CAP_DAC_OVERRIDE
files:
- path: etc/docker/daemon.json
contents: '{"debug": true}'
trust:
org:
- linuxkit
- library