ubuntu安装chrome及firefox

本文主要讲述一下如何在dockerfile里头安装chrome及firefox。

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进去

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,另外需要启动display

Xvfb :10 -ac &
export DISPLAY=:10

安装中文字体

由于默认的是英文的,没有中文字体的话,访问中文网站之类的会乱码,需要安装下中文字体

RUN apt-get install -y --force-yes --no-install-recommends \
        fonts-wqy-microhei \
        ttf-wqy-zenhei
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值