Deploy Rendertron as a container on Docker Cloud

Rendertron is a really nice renderer based on headless Chrome. We use it primarily to pre-render Angular frontends for sharing social links on Facebook, Linkedin, Twitter etc.
You can fetch the source code and a Dockerfile at https://github.com/GoogleChrome/rendertron
To create a containerized version of Rendertron, clone the code, switch to the root of the checkout and build it from scratch:


docker build -t rendertron . --no-cache=true

To run Rendertron in a container, you need to elevate container privileges, otherwise you will be confronted with ECONNREFUSED error.


docker run -it -p 8080:8080 --cap-add SYS_ADMIN rendertron

To deploy your freshly created container on Docker Cloud push it to a repository, accessible to Docker Cloud and add it to your stackfile (please note that xxxxxx is the name of your repo and compose-rendertron is the name of your image. Note the cap_add and privileged settings.


rendertron:
cap_add:
- ALL
image: 'xxxxxx/compose-rendertron:latest'
ports:
- '8080:8080'
privileged: true
restart: on-failure
roles:
- global

Redeploy your stack. You are set.