0

I have a Docker image based on Ubuntu that runs a supervisor script as the CMD at the end of the Dockerfile. This successfully runs uwsgi and nginx in the container on start up. However, the following appended at the end of the supervisor-app.conf does not work:

[program:Xvfb]
command=/usr/bin/Xvfb :1 -screen 0 1024x768x16 &> xvfb.log  &

When I open a shell into a running docker instance there is no X instance running:

root@9221694363ea:/# ps aux | grep X
root        39  0.0  0.0   8868   784 ?        S+   15:32   0:00 grep --color=auto X

However, running exactly the same command as in the supervisor-app.conf works

root@9221694363ea:/# /usr/bin/Xvfb :1 -screen 0 1024x768x16 &> xvfb.log  &
 [1] 40
 root@9221694363ea:/# ps aux | grep X                                      
 root        40  1.2  0.1 170128 21604 ?        Sl   15:33   0:00 /usr/bin/Xvfb :1 -screen 0 1024x768x16
 root        48  0.0  0.0   8868   792 ?        S+   15:33   0:00 grep --color=auto X

so what's wrong with the line in the supervisor-app.conf?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Apollo Marquis
  • 181
  • 2
  • 8

1 Answers1

0

Supervisor does not handle bash specific operators such as the-run-in-the -background '&' or redirections like '>' as per my original failing config line. I solved it by using bash -c thus:

    [program:Xvfb]
    command=bash -c "/usr/bin/Xvfb :1 -screen 0 1024x768x16 &> xvfb.log"

Now when I get into the docker bash shell the Xvfb window is created waiting for me to use it elsewhere in the code.

Apollo Marquis
  • 181
  • 2
  • 8