Running in Docker
Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the Apify Platform.
All images can be found in their GitHub repo and in our DockerHub.
Overview
Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images.
apify/actor-node
apify/actor-node-puppeteer-chrome
apify/actor-node-playwright
apify/actor-node-playwright-chrome
apify/actor-node-playwright-firefox
apify/actor-node-playwright-webkit
Versioning
Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version.
We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.
Node.js versioning
Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js versions 16 and 18 are supported (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag.
# Use Node.js 16
FROM apify/actor-node:16
Automation library versioning
Images that include a pre-installed automation library, which means all images that include puppeteer
or playwright
in their name, are also tagged with the pre-installed version of the library. For example, apify/actor-node-puppeteer-chrome:16-13.7.0
comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with puppeteer
will not match the version of Chromium that's pre-installed.
Similarly apify/actor-node-playwright-firefox:14-1.21.1
runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1.
Installing apify/actor-node-puppeteer-chrome
(without a tag) will install the latest available version of Node.js and puppeteer
.
Pre-release tags
We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a beta
suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:
# Without library version.
FROM apify/actor-node:16-beta
# With library version.
FROM apify/actor-node-playwright-chrome:16-1.10.0-beta