I am currently working on a PHP (Drupal) project for which I need to render a PDF. In the past I have worked with several PHP libraries to generate PDF's. While some work better than others, none of them work perfercly. So for this project we have decided to try to use headless Chrome / Chromium instead. The results are promising (on the dedicated acceptance server), but it doesn't yet work in our Docker development environment.


I run Docker (desktop) on WSL2 on a Windows 10 machine. The project has been setup using docker-compose.


For our Docker environment we work mostly with Wodby images. For running headless Chrome / Chromium I tried selenium/standalone-chrome, but couldn't get it up and running for some reason. So I decided to just add Chromium to a custom Dockerfile for my PHP container for now:


FROM wodby/drupal-php:${PHP_TAG}

USER root

RUN apk update; \
    apk upgrade; \
    apk add chromium;

I also added a network alias to the nginx container (in docker-compose.yml), to make sure that I can call the development domain from my PHP container.

          - somedomain.site

The problem

When I test the domain from within the PHP container via Curl it works fine:

curl http://somedomain.site/

I get my complete HTML response

However, when I test the same URL via Chromium it doesn't give a response at all:

chromium-browser --headless --no-sandbox --dump-dom http://somedomain.site/

When I test an external domain however (like https://devops.stackexchange.com/) it works fine.

Possible cause

It seems most likely that Chromium uses some other kind of DNS which doesn't know about the Docker domains, while Curl does...

Now whenever I call any URL from Chromium the following warning is being displayed:

[0727/124526.452320:WARNING:dns_config_service_posix.cc(342)] Failed to read DnsConfig.

Then for an existing external domain it still works though, despite this warning message. This warning however may be the cause of my problem. I haven't been able to find out how to fix this warning.

Someone mentioned another Docker image that would fix the problem, but in my case that Docker image has the exact same problem.

Does anyone know how to fix this or how to further investigate it?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.