1
docker -H :4000 events | ./docker_events.py

docker -H :4000 events will gives the events continuously until we press Crtl+C. So, I pipe the output to my custom script docker_events.py which parses the output which was returned by docker -H :4000 events and then gives it own version of output (actually it will send json data to redis!)

I inclued the above line in supervisord .conf like below

[program:docker_events]
command=docker -H :4000 events | python /root/docker_events.py
autostart=true
autorestart=true
stderr_logfile=/var/log/docker_events.err.log
stdout_logfile=/var/log/docker_events.out.log

but it is not working properly; I can see error in docker_events.err.log

Usage:  docker events [OPTIONS]

Get real time events from the server
docker: "events" requires 0 arguments.
See 'docker events --help'.

It is taking | as argument. So can I resolve this issue?

3

You use the shell piping and it is not handled properly in your config file. My guess a correct command might be

command=bash -c "docker -H :4000 events | python /root/docker_events.py"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.