0

I have a docker container that uses as an entrypoint /bin/bash. Once in the container, I can start xvfb in this way:

Xvfb :1 -screen 0 1024x768x24 +extension GLX +render -noreset >> xsession.log 2>&1 &

However, I would like this command to be performed in the Dockerfile, and then entering the container. I would like to use /bin/bash interactively. I have tried several solution but nothing seems to work.

What I have tried:

runxvfb.sh
#!/bin/sh
echo try
Xvfb :1 -screen 0 1024x768x24 +extension GLX +render -noreset >> xsession.log 2>&1 &

In the Dockerfile

ADD runxvfb.sh /runxvfb.sh
RUN chmod a+x /runxvfb.sh
CMD ["/runxvfb.sh; bin/bash"]

and several combination of this approach, but it doesn't seem to work. Once inside the container, ps shows that there is no xvfb daemon running.

Vaaal88
  • 591
  • 1
  • 7
  • 25
  • that won't leave the interactive bash open - changed my question to make it clear I want to end up in /bin/bash – Vaaal88 Oct 28 '20 at 09:51
  • That also doesn't seem to work. My runxvfb.sh file is #!/bin/sh echo try Xvfb :1 -screen 0 1024x768x24 +extension GLX +render -noreset >> xsession.log 2>&1 & I get "try" but the docker container gets closed after that (see updated question) – Vaaal88 Oct 28 '20 at 10:07
  • You can't launch background processes in a Dockerfile; the Docker image only contains the filesystem and not any running processes. A virtual machine (with an X server, full init system, standard Linux desktop, and either an ssh daemon or a graphical console) might match this use case better. – David Maze Oct 28 '20 at 12:40

0 Answers0