Open frederikhors opened 1 year ago
What is the execution context? How do you run the container?
Cannot reproduce it on direct call to chromium-browser ... --print-to-pdf='/tmp/test.pdf' ...
from an image built from the dockerfile you gave.
$ cat Dockerfile
FROM alpine:3.17
RUN apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium-swiftshader \
ttf-freefont \
font-noto-emoji \
&& apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
font-wqy-zenhei
# I tried with these too, same error
# RUN mkdir -p /usr/src/app \
# && adduser -D chrome \
# && chown -R chrome:chrome /usr/src/app
# USER chrome
# WORKDIR /usr/src/app
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/lib/chromium/
ENV CHROMIUM_FLAGS="--disable-dev-shm-usage --disable-software-rasterizer"
$ docker image build -t test .
[+] Building 27.5s (7/7) FINISHED
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 657B
=> [internal] load .dockerignore
=> => transferring context: 2B
=> [internal] load metadata for docker.io/library/alpine:3.17
=> [auth] library/alpine:pull token for registry-1.docker.io
=> [1/2] FROM docker.io/library/alpine:3.17@sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126
=> => resolve docker.io/library/alpine:3.17@sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126
=> => sha256:9ed4aefc74f6792b5a804d1d146fe4b4a2299147b0f50eaf2b08435d7b38c27e 1.47kB / 1.47kB
=> => sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126 1.64kB / 1.64kB
=> => sha256:b6ca290b6b4cdcca5b3db3ffa338ee0285c11744b4a6abaa9627746ee3291d8d 528B / 528B
=> [2/2] RUN apk upgrade --no-cache --available && apk add --no-cache chromium-swiftshader ttf-freefont font-noto-emoji && apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge
=> exporting to image
=> => exporting layers
=> => writing image sha256:21a08a622a103c30aabf55b2e2b5671240dd5cc0c95866ec5c74d813c163ec80
=> => naming to docker.io/library/test
$ docker run -it test /bin/sh
/ # chromium-browser --headless --no-sandbox --disable-setuid-sandbox --disable-gpu --disable-dev-shm-usage --run-all-compositor-stages-before-draw --print-to-pdf='/tmp/test.pdf' /tmp/test.html
[0510/100150.474000:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0510/100150.487552:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0510/100150.487759:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0510/100150.488013:WARNING:dns_config_service_linux.cc(429)] Failed to read DnsConfig.
[0510/100150.496589:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[0510/100150.509475:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process.
[0510/100150.558819:WARNING:dns_config_service_linux.cc(429)] Failed to read DnsConfig.
4576 bytes written to file /tmp/test.pdf
/ #
Hi guys! Thank you for your amazing work!
I'm trying to build a custom Dockerfile using your one:
start.sh is like this:
The app starts. The app calls chrome with the below OS command (from dir
/usr/bin
):Chrome starts but errors with:
As you can see the MAIN error is:
Failed to write file '/tmp/test.pdf': No such file or directory (2)\n"
What is causing this?
Is this a permissions issue?