我们如何使用dpkg在dockerfile中的高山图像上安装google-chrome-stable? [英] How can we install google-chrome-stable on alpine image in dockerfile using dpkg?

查看:165
本文介绍了我们如何使用dpkg在dockerfile中的高山图像上安装google-chrome-stable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用dpkg在高山图像上安装google-chrome-stable.但是,已经安装了dpkg,但没有安装google-chrome-stable,而是返回此错误?是否可以使用dpkg或其他方式在高山图像中安装google-chrome-stable?

I am trying to install google-chrome-stable on alpine image using dpkg. However, the dpkg is installed but it does not install google-chrome-stable and return this error instead? Is there a way to install google-chrome-stable in alpine image either using dpkg or other way?

dpkg: regarding google-chrome-stable_current_amd64.deb containing 

google-chrome-stable:amd64, pre-dependency problem:
 google-chrome-stable:amd64 pre-depends on dpkg (>= 1.14.0)

dpkg: error processing archive google-chrome-stable_current_amd64.deb (--install):
 pre-dependency problem - not installing google-chrome-stable:amd64
Errors were encountered while processing:

Dockerfile:

Dockerfile:

# Base image
FROM ruby:2.6.3-alpine3.10
# Use node version 10.16.3, yarn version 1.16.0
RUN apk add  --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ nodejs=10.16.3-r0
RUN apk add  --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.10/community/ yarn=1.16.0-r0

# Install dependencies
RUN apk upgrade
RUN apk --update \
    add build-base \
    git \
    tzdata \
    nodejs \
    nodejs-npm \
    bash \
    curl \
    yarn \
    gzip \
    postgresql-client \
    postgresql-dev \
    imagemagick \
    imagemagick-dev \
    imagemagick-libs \
    chromium \
    chromium-chromedriver \
    ncurses \
    less \
    dpkg=1.19.7-r0 \
    chromium \
    chromium-chromedriver

RUN dpkg --add-architecture amd64
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb

# This is the base directory used in any
# further COPY, RUN and ENTRYPOINT commands
WORKDIR /webapp
# Copy Gemfile and Gemfile.lock and run bundle install
COPY Gemfile* /webapp/
RUN gem install bundler -v '1.17.3' && \
    bundle _1.17.3_ install

# Copy everything to /webapp for docker image
COPY . ./

EXPOSE 3000

# Run the application
CMD ["rails", "server", "-b", "0.0.0.0"]

推荐答案

以这种方式安装Chrome .deb文件在Alpine上不起作用.

Installing the Chrome .deb file this way won't work on Alpine.

dpkg 该软件包可在Alpine仓库中找到,并且对于安装轻量级Debian软件包很有用,由于无法满足许多Debian依赖关系,因此您将无法使用它来安装复杂的Debian软件包.Alpine通常不兼容Debian(依靠 musl libc ),因此使用apk安装本机Alpine软件包是正确的方法.

While the dpkg package is available in the Alpine repository, and is useful for installing lightweight Debian packages, you won't be able to use it for installing complex Debian packages, since it'll be impossible to satisfy many Debian dependencies. Alpine is generally not Debian compatible (relying on musl libc), so installing native Alpine packages using apk is the right way to go.

AFAIK,目前没有与Google Chrome Alpine Linux兼容的musl-libc构建.

AFAIK, there's currently no Google Chrome Alpine Linux compatible, musl-libc build.

但是,您可以安装 Chromium 浏览器,可以使用 apk 包进行访问:

You could, however, install the Chromium browser, which is available using an apk package:

apk添加铬

另一个选择是在香草Alpine映像上启用glibc,使其与Debian二进制文件兼容.这是一个相当简单的过程,请参见: Dockerfile .但是,它可能不适用于具有现有应用程序(例如 ruby​​:2.6.3-alpine3.10 )的图像.而且,即使在Alpine上安装了glibc,Chrome也不可能没有问题地运行.我已经做了快速尝试( Dockerfile ),但是无法不会超越第一个段错误.

Another option is enabling glibc on a vanilla Alpine image, making it compatible with Debian binaries. This is a fairly simple procedure, see: Dockerfile. However, it may not be suitable for images with existing applications such as ruby:2.6.3-alpine3.10. Moreover, even with a glibc setup on Alpine, Chrome is not likely to run without issues. I have made a quick attempt (Dockerfile) but couldn't get past the first segfault.

这篇关于我们如何使用dpkg在dockerfile中的高山图像上安装google-chrome-stable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆