Public | Automated Build

Last pushed: 4 days ago
Short Description
PhantomJS 2 is a headless WebKit scriptable (browser) with a JavaScript API
Full Description

Supported tags and respective Dockerfile links

What is PhantomJS

PhantomJS is a headless WebKit browser, often used via WebDriver for web system testing.
It's based on WebKit, runs JavaScript, and allows to take screenshots.

Features of this image

This Dockerized version of PhantomJS is:

  • Small: Using Debian image (below 100 MB, while Ubuntu is about 230 MB), and removing packages used during build.
  • Simple: Exposes default port, easy to extend.
  • Secure: Runs as non-root UID/GID 72379 (selected randomly to avoid mapping to an existing user) and uses dumb-init to reap zombie processes.


JavaScript interactive shell

Start PhantomJS in REPL:

$ docker run --rm wernight/phantomjs

Remote WebDriver

Start as 'Remote WebDriver mode' (embedded GhostDriver):

$ docker run -d -p 8910:8910 wernight/phantomjs phantomjs --webdriver=8910

To connect to it (some examples per language):

  • Java:

    WebDriver driver = new RemoteWebDriver(
        new URL(""),
  • Python (after running $ pip install selenium):

    from selenium import webdriver
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
    driver = webdriver.Remote(


Improvement ideas and pull requests are welcome via
Github Issue Tracker.

Docker Pull Command
Source Repository

Comments (4)
7 days ago

This container work on my fedora, but not on my alpine 3.6 VPS :/ If someone have an idea to fix this, tell me

a month ago

Hey wernight, thanks for the container.

I need to start phamtomjs with some args. Did it like below:
phantomjs --web-security=no --ssl-protocol=any --ignore-ssl-errors=true --webdriver=8910
But it doesn't seems to work. Any idea?

3 months ago

When I run the image with -it option, it works but displays me this:

docker run -it wernight/phantomjs /bin/bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

3 months ago

Hello wernight!

Thanks for this container. On my Synology NAS, the container starts but stops after few seconds.

Any idea why? Is it some ports problem? Or do I have to create the phantomjs user on my NAS?

Thanks for help.