在 Docker python 镜像中安装 Firefox

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

我想在 Python 映像中安装 Firefox,以便能够在 Web 应用程序上运行回归测试。

假设我有以下图像,我想在其中安装 Firefox:

# Image:
FROM python:3.12-bullseye AS builder

# Update kernel with basic tools:
RUN apt-get update \
    && apt-get install -y \
       apt-transport-https \
       build-essential \
       ca-certificates \
       software-properties-common

但是 Firefox 在此发行版中不可用,如果我在容器内运行以下命令:

apt-cache search firefox

它什么也不返回。

我尝试添加存储库:

# Add Firefox:
RUN add-apt-repository ppa:mozillateam/ppa
RUN apt-get update --allow-insecure-repositories && apt-get install -y firefox

但是我遇到了依赖冲突:

The following packages have unmet dependencies:
 firefox : Depends: libc6 (>= 2.38) but 2.31-13+deb11u8 is to be installed
           Depends: libstdc++6 (>= 13.1) but 10.2.1-6 is to be installed
           Depends: libx11-xcb1 (>= 2:1.8.7) but it is not going to be installed
           Recommends: xul-ext-ubufox but it is not installable
           Recommends: libcanberra0 but it is not going to be installed
           Recommends: libdbusmenu-glib4 but it is not going to be installed
           Recommends: libdbusmenu-gtk3-4 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如何在

python:3.12-bullseye
图像中正确安装Firefox?

docker firefox dockerfile
1个回答
0
投票

如果您可以使用有点过时的浏览器版本,标准存储库中有 firefox-esr 软件包。

FROM python:3.12-bullseye
RUN apt update && apt install firefox-esr
© www.soinside.com 2019 - 2024. All rights reserved.