#!/usr/bin/env bash set -e # This file is for testing the logging of docker output #8 LOG_FILE=./jobs.log touch ${LOG_FILE} UUID="xxxxxxxxxxxxxxxxx" exec > >(read message; echo "${UUID} $(date) [info] $message" | tee -a ${LOG_FILE} ) exec 2> >(read message; echo "${UUID} $(date) [error] $message" | tee -a ${LOG_FILE} >&2) echo "Start" docker run alpine sh -c 'while :; do echo "ping"; sleep 1; done' # [error] write /dev/stdout: broken pipe # --log-driver syslog <- errors # --log-driver none <- errors echo "End"