Docker Wkhtmltopdf HostNotFoundError
Docker Wkhtmltopdf HostNotFoundError
当我尝试在 docker 容器中 运行 wkhtmltopdf (v 0.12.5) 时(如果我尝试从外部 url (http://google.de), 我收到这个错误:
wkhtmltopdf http://app.local/web/app_dev.php/get/media media.pdf
Loading pages (1/6) Error: Failed to load
http://app.local/web/app_dev.php/get/media, with network status code 3
and http status code 0 - Host app.local not found Error: Failed
loading page http://app.local/web/app_dev.php/get/media (sometimes it
will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: HostNotFoundError
我想问题是,容器本身不知道我在本地计算机上添加的 /etc/hosts 条目
127.0.0.1 app.local
我很困惑和卡住了,因为我不知道如何解决这个问题。我使用 symfony,但这并不重要,因为当我通过 docker exec -it bash 在容器内部使用它时,我得到了上面的错误。
在没有 docker 的情况下运行脚本工作正常。
任何人都可以为我提供解决方案或提示如何获得此 运行nin' 吗?[=14=]
您可以使用 --add-host
将主机添加到容器的 /etc/hosts
,请参阅 this。
类似于:
$ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
172.17.0.22 09d03f76bf2c
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
86.75.30.9 db-static
当我尝试在 docker 容器中 运行 wkhtmltopdf (v 0.12.5) 时(如果我尝试从外部 url (http://google.de), 我收到这个错误:
wkhtmltopdf http://app.local/web/app_dev.php/get/media media.pdf Loading pages (1/6) Error: Failed to load http://app.local/web/app_dev.php/get/media, with network status code 3 and http status code 0 - Host app.local not found Error: Failed loading page http://app.local/web/app_dev.php/get/media (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: HostNotFoundError
我想问题是,容器本身不知道我在本地计算机上添加的 /etc/hosts 条目
127.0.0.1 app.local
我很困惑和卡住了,因为我不知道如何解决这个问题。我使用 symfony,但这并不重要,因为当我通过 docker exec -it bash 在容器内部使用它时,我得到了上面的错误。 在没有 docker 的情况下运行脚本工作正常。
任何人都可以为我提供解决方案或提示如何获得此 运行nin' 吗?[=14=]
您可以使用 --add-host
将主机添加到容器的 /etc/hosts
,请参阅 this。
类似于:
$ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
172.17.0.22 09d03f76bf2c
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
86.75.30.9 db-static