Q:

Command output redirect with supervisord

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? 

A:

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"

