Redirect several log files in docker container to stdout (legacy application)

I have to put legacy application into Docker container. The app is running fine but I cannot display all the log files. The problem is that the app is creating several log files (e.g. service.log, license.log, security.log etc.) AFTER starting the executable.

I have a starting script (let’s call it start.sh) which prepares some things (links, config) and then starts the app which creates the mentioned log files.

  • How should I pass sensitive environment variables to Amazon ECS tasks?
  • Dockerize stack: MapServer - AngularJs web app - Lumen API - PostgreSQL
  • Docker kill not working when executed in shell script
  • How to connect to Docker instance from a different VM
  • Can Assign two Pods in Replication Controller to the two Different Nodes on Kubernetes?
  • Kubernetes on Fedora 21 Pod Stays Pending
  • After some googling I have found similar problem and try to apply the solution that uses named pipes (creating link to /proc/1/fd/1 did not worked). So I placed the following in the starting script:

    mkfifo /path/to/app/license.log && tail -f /path/to/app/license.log &
    mkfifo /path/to/app/security.log && tail -f /path/to/app/security.log &
    ...
    

    but the problem is that only FIRST file will be redirected to docker logs. The others are not visible at all.

    The curious thing is that in start.sh I have a line source before_start.sh which executes some specific commands depending on environment. Placing the mkfifo license.log in the start.sh and the mkfifo service.log in the before_start.sh works.
    The problem is that I have more files and do not want to source all of them.

    Does anyone have an idea how to solve this?

  • create file in shared folder docker container
  • error: unable to unlink old 'gulpfile.js' (Permission denied) while using Docker Compose for development environment
  • Motivation for putting Docker containers inside an AWS EC2 instance
  • Get elastic beanstalk environment variables in docker container
  • Sails application cannot accessed from web browser. Connection refused
  • Possible to use Docker machine with continuous integration tools?
  • One Solution collect form web for “Redirect several log files in docker container to stdout (legacy application)”

    Because it is a legacy application we still have to have the log files in place. In that case the solution that works for me is to create the files by touch and read them using tail:

    touch /path/to/app/logfile.log && tail -f /path/to/app/logfile.log &
    

    So replacing mkfifo with touch solved my problem.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.