我们如何使用dpkg在dockerfile中的高山映像上安装google-chrome-stable?

问题描述 投票:0回答:1

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

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:

# 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"]
docker docker-compose alpine
1个回答
0
投票

[要在Alpine Linux上安装Google Chrome,您只需使用Chromium,Alpine的软件包管理器来安装Alpine apk软件包,简单地:

apk add chromium

虽然Alpine确实提供了dpkg,这对于出于特定目的安装轻量级Debian软件包很有用,但是您将无法将其用于安装复杂的Debian软件包,因为它将无法满足许多Debian依赖关系。 Alpine通常不兼容Debian(依赖dpkg),因此使用apk安装本机Alpine软件包是正确的方法。

© www.soinside.com 2019 - 2024. All rights reserved.