我使用 Dockerfile 来运行带有 Chrome 和一些其他应用程序的 Ubuntu 容器,它看起来是这样的:
FROM ubuntu:23.04
ENV USER=root
ENV PASSWORD=password1
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update && \
echo "tzdata tzdata/Areas select America" > ~/tx.txt && \
echo "tzdata tzdata/Zones/America select New York" >> ~/tx.txt && \
debconf-set-selections ~/tx.txt && \
apt-get install -y abiword gnupg apt-transport-https wget software-properties-common ratpoison novnc websockify libxv1 libglu1-mesa xauth x11-utils xorg tightvncserver && \
wget https://kumisystems.dl.sourceforge.net/project/virtualgl/2.6.5/virtualgl_2.6.5_amd64.deb && \
wget https://kumisystems.dl.sourceforge.net/project/turbovnc/2.2.7/turbovnc_2.2.7_amd64.deb && \
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt install -y ./google-chrome-stable_current_amd64.deb && \
dpkg -i virtualgl_*.deb && \
dpkg -i turbovnc_*.deb && \
mkdir ~/.vnc/ && \
mkdir ~/.dosbox && \
echo $PASSWORD | vncpasswd -f > ~/.vnc/passwd && \
chmod 0600 ~/.vnc/passwd && \
echo "set border 1" > ~/.ratpoisonrc && \
echo "exec google-chrome --no-sandbox">> ~/.ratpoisonrc && \
openssl req -x509 -nodes -newkey rsa:2048 -keyout ~/novnc.pem -out ~/novnc.pem -days 3650 -subj "/C=US/ST=NY/L=NY/O=NY/OU=NY/CN=NY [email protected]"
EXPOSE 80
CMD /opt/TurboVNC/bin/vncserver && websockify -D --web=/usr/share/novnc/ --cert=~/novnc.pem 80 localhost:5901 && tail -f /dev/null
相关内容如下:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt install -y ./google-chrome-stable_current_amd64.deb
我收到此错误:
#5 73.69 Some packages could not be installed. This may mean that you have
#5 73.69 requested an impossible situation or if you are using the unstable
#5 73.69 distribution that some required packages have not yet been created
#5 73.69 or been moved out of Incoming.
#5 73.69 The following information may help to resolve the situation:
#5 73.69
#5 73.69 The following packages have unmet dependencies:
#5 73.75 google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.17) but it is not installable
#5 73.75 Depends: libatk-bridge2.0-0:amd64 (>= 2.5.3) but it is not installable
.
.
.
many others
我不明白为什么无法安装这些依赖项。根据建议,我根据 dpkg 应该解决依赖项问题的逻辑进行了更改apt install -y ./google-chrome-stable_current_amd64.deb
,dpkg -i ./google-chrome-stable_current_amd64.deb
重新运行脚本,出现此新错误:
#5 105.4 dpkg: error processing archive ./google-chrome-stable_current_amd64.deb (--install):
#5 105.4 package architecture (amd64) does not match system (arm64)
#5 105.4 Errors were encountered while processing:
#5 105.4 ./google-chrome-stable_current_amd64.deb
我更不明白,因为我没有看到脚本中 arm64 的设置位置,也许是默认选项?(我在带有 M2 芯片的 macOS 中运行 Docker)
答案1
看来您的架构是arm64
,而脚本设置为安装软件包amd64
。
在正常情况下,这应该非常简单,只需进行基本的搜索和替换:在 Dockerfile 中用amd64
替换所有实例。arm64
然而,我为您做了家庭作业,但似乎您想要下载的软件包(virtualgl
,turbovnc
或google-chrome-stable
)都没有arm64
可用的软件包(至少在那些下载位置没有)。
然后,您通过运行架构请求了一个不可能的情况arm64
,但要求仅适用于的包amd64
。
因此您必须:
- 切换到
amd64
架构 arm64
编译架构包- 寻找替代软件包来实现你想要的