Code Monkey home page Code Monkey logo

Comments (1)

zigarn avatar zigarn commented on August 20, 2024

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
/ # 

from alpine-chrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.