ubuntu安裝chrome及firefox

本文主要講述一下如何在dockerfile裏頭安裝chrome及firefox。python

chrome

RUN apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
  gnupg \
    --no-install-recommends

RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update
## xdg-icon-resource: No writable system icon directory found.
RUN apt-get install -y --force-yes --no-install-recommends hicolor-icon-theme
RUN apt-get install -y \
    google-chrome-stable \
    --no-install-recommends

若是沒法訪問dl.google.com的話,估計須要自行下載而後add進去linux

firefox

RUN apt-get install -y --force-yes --no-install-recommends python-software-properties software-properties-common
RUN apt-add-repository ppa:mozillateam/firefox-next
RUN apt-get update
RUN apt-get install -y --force-yes --no-install-recommends firefox xvfb
RUN apt-get install -y --force-yes --no-install-recommends x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps

firefox的啓動有點麻煩,須要設置XDG_RUNTIME_DIR,另外須要啓動displaychrome

Xvfb :10 -ac &
export DISPLAY=:10

安裝中文字體

因爲默認的是英文的,沒有中文字體的話,訪問中文網站之類的會亂碼,須要安裝下中文字體docker

RUN apt-get install -y --force-yes --no-install-recommends \
        fonts-wqy-microhei \
        ttf-wqy-zenhei
相關文章
相關標籤/搜索