I need to kick off Selenium from a Java application running in the background in a Docker container. The kick off fails because the X11 environment is not a
We can also connect a docker container directly to a users Xserver: See the answer to Can you run GUI apps in a docker container?
We have almost the same case. Bamboo is CI/CD tool, selenium and java8 is tool for regression tests, and all these are running inside of a docker container. So I can say that it is 100% possible.
What probably can help you is xvbf (headless X-server) and x11vnc (vnc-server to see what actually happening inside of container)
RUN set -x &&\
apt-get update &&\
apt-get install -y xvfb x11vnc &&\
apt-get clean autoremove &&\
mkdir ~/.vnc/ && x11vnc -storepasswd 111222 ~/.vnc/passwd &&\
echo "export DISPLAY=:0" >> ~/.bashrc
If you want, you can also install firefox
RUN set -x\
&& curl -O https://ftp.mozilla.org/pub/firefox/releases/47.0.1/linux-x86_64/ru/firefox-47.0.1.tar.bz2\
&& tar xvjf firefox-47.0.1.tar.bz2 -C /usr/local/src\
&& rm -rf firefox-47.0.1.tar.bz2\
&& ln -s /usr/local/src/firefox/firefox /usr/local/bin/firefox
Also add this command to startup wizard or entrypoint script
source ~/perl5/perlbrew/etc/bashrc
rm -f /tmp/.X10-lock
Xvfb :0 -screen 0 1600x1200x24 &
firefox -height 1200 -width 1600 &
x11vnc -usepw -forever -shared &
As result after you start container, you will be able to connet to this container through any vnc client and see firefox welcome page, or how webtests go, in case they are running.