无法在 Docker 上安装 Google Chrome
Unable to install Google Chrome on Docker
我目前在 docker 中安装 Google Chrome 时遇到问题 - 这个设置昨天工作正常,但今天我收到这个错误 -
这就是我安装的方式Chrome
ENV CHROME_VERSION "google-chrome-stable"
RUN apt-get update
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/*
这会引发错误
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
如果我删除 apt-get update
部分,则不会出现上述错误,但找不到 google-chrome-stable
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/*
那么错误就是
E: Unable to locate package google-chrome-stable
此外,我发现 link 建议删除 jessie
- https://lists.debian.org/debian-devel-announce/2019/03/msg00006.html
我如何配置以消除这两个错误,因为昨天一切正常并且我的 docker 构建成功。
http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
确实提供了 404。我不知道为什么会这样,但你不是唯一受影响的人:https://github.com/docker-library/official-images/issues/3551
因此,作为解决方法,您必须在 运行 apt-get update
之前的 sources.list
中注释掉包含 URL 的行,以确保它不会失败.我为此使用了 sed
(sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g'
)。
所以我可以通过修改你的 Dockerfile 来成功安装 chrome:
FROM debian:jessie
ENV CHROME_VERSION "google-chrome-stable"
RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \
&& apt-get update && apt-get install wget -y
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \
&& apt-get update && apt-get -qqy install ${CHROME_VERSION:-google-chrome-stable}
CMD /bin/bash
我目前在 docker 中安装 Google Chrome 时遇到问题 - 这个设置昨天工作正常,但今天我收到这个错误 -
这就是我安装的方式Chrome
ENV CHROME_VERSION "google-chrome-stable"
RUN apt-get update
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/*
这会引发错误
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
如果我删除 apt-get update
部分,则不会出现上述错误,但找不到 google-chrome-stable
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/*
那么错误就是
E: Unable to locate package google-chrome-stable
此外,我发现 link 建议删除 jessie
- https://lists.debian.org/debian-devel-announce/2019/03/msg00006.html
我如何配置以消除这两个错误,因为昨天一切正常并且我的 docker 构建成功。
http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
确实提供了 404。我不知道为什么会这样,但你不是唯一受影响的人:https://github.com/docker-library/official-images/issues/3551
因此,作为解决方法,您必须在 运行 apt-get update
之前的 sources.list
中注释掉包含 URL 的行,以确保它不会失败.我为此使用了 sed
(sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g'
)。
所以我可以通过修改你的 Dockerfile 来成功安装 chrome:
FROM debian:jessie
ENV CHROME_VERSION "google-chrome-stable"
RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \
&& apt-get update && apt-get install wget -y
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \
&& apt-get update && apt-get -qqy install ${CHROME_VERSION:-google-chrome-stable}
CMD /bin/bash