Chrome Error when running JSReport inside Docker Container



  • Hi @jan_blaha
    I am trying to run JSReport inside a Linux Docker container and getting the an error launching Chrome. Below is my dockerfile

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
    
    RUN apt-get update -yq \
    && apt-get install curl gnupg -yq \
    && curl -sL https://deb.nodesource.com/setup_8.x | bash \
    && apt-get install nodejs -yq
    
    RUN apt-get install -y --no-install-recommends libgconf-2-4 git wget ca- certificates libgconf-2-4 && \
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
    
    apt-get update && \ 
    apt-get install -y lsb-release google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libxtst6 libxss1 --no-install-recommends
    
    
    
    ENV chrome_launchOptions_executablePath google-chrome-stable
    
    ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage,--single-process,--no-zygote
    
    WORKDIR /app
    
    FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
    
    WORKDIR /src
    
    COPY ["DemoProject.csproj", ""]
    
    RUN dotnet restore "./DemoProject.csproj"
    
    COPY . .
    
    WORKDIR "/src/."
    
    RUN dotnet build "DemoProject.csproj" -c Release -o /app/build
    
     FROM build AS publish
    
    RUN dotnet publish "DemoProject.csproj" -c Release -o /app/publish
    
    
    
     FROM base AS final
    
    WORKDIR /app
    
    COPY --from=publish /app/publish .
    
    ENTRYPOINT ["dotnet", "DemoProject.dll", "--environment=Debug"]
    

    This is error I am getting when invoking JSREPORT
    0_1612282776394_Screen Shot 2021-02-02 at 4.17.46 PM.png

    Can you please help with this?
    Let me know if I need to share any other information.



  • Hi @jan_blaha
    I was able to resolve this issue by installing few dependencies for Debian. Here is the modified Docker file in case some one else faces similar issue.

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
    # Below dependencies are required for Debian
    RUN apt-get update && \  
             apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
    
    RUN apt-get install -y --no-install-recommends libgconf-2-4 gnupg git curl 
    libgconf-2-4 && \
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    
    sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
    
    apt-get update && \ 
    
    apt-get install -y lsb-release google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libxtst6 libxss1 --no-install-recommends && \
    
    rm -rf /var/lib/apt/lists/*
    
    ENV chrome_launchOptions_executablePath google-chrome-stable
    
    ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage,--single-process,--no-zygote
    

    However this has increased the overall docker image size. Hence wanted to check if all of these dependencies are required or not?


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.