I am trying to use Jenkins as a docker container. For this purpose, I use the official docker image. As we have some integrations tests based on Selenium (Vaadin Workbench really), I need to run phantomjs as headless. The tests are executed correctly the same as before being dockerized. My web application (a server) executes correctly and phantomjs is launched later as a client and executes all tests correctly. This is the expected behaviour.
Now I like the idea of using jenkins in an alpine system. In general I use alpine in my other docker containers due to its small size. Jenkins docker official image also has an alpine based image that I can use it. In general I have no problem with other tools I need to install (ansible, ...). And they works great in the alpine version. But I am facing an issue with phantomjs.
First of all, I install phantomjs from a github project that has an alpine compilation. Here there are the commands I use:
RUN apk --no-cache add fontconfig && \
mkdir -p /usr/share && \
curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/2.11/phantomjs-alpine-x86_64.tar.bz2 | tar xj --directory /usr/share && \
chmod +x /usr/share/phantomjs/phantomjs && \
ln -s /usr/share/phantomjs/phantomjs /usr/bin/phantomjs
It seems that works fine. If I access to the docker container with a docker exec -it jenkins sh
, I can execute phantomjs from the command line. But when jenkins executes the tests, I have this error:
WebDriverException: Timed out waiting for driver server to start
Before any test starts. The application server is running (I can connect to it from my browser) but jenkins cannot launch phantomjs to connect it. I have checked the phantomjs logs to see if this is the issue but it has permissions to write (still, the file is empty). Still I can execute phantomjs from the command line, but jenkins + selenium cannot.
Of course, run jenkins in an alpine machine is not mandatory and now I go back to the standard docker image based in openjdk. But now I am curious about this issue and I am not sure if this is a phantomjs issue or an alpine issue. Or maybe I need some extra configuration or packets to run phantomjs in alpine.
Do anybody has the same issue when using jenkins + alpine + selenium (or equivalent)? Any clue of what can cause this error?