首页 > 解决方案 > Run Xvfb and bin/bash in Dockerfile

问题描述

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.

标签: dockerxvfb

解决方案


推荐阅读