Dockerfile
我想在其中安装这个translate-shell
,因此我必须将其添加contrib non-free
到/etc/apt/source.list
.
FROM node:lts-bookworm-slim
RUN sed -r -i 's/^deb(.*)$/deb\1 contrib non-free/g' /etc/apt/sources.list
RUN apt update \
&& apt upgrade \
&& apt install bc -y \
&& apt install git -y \
&& apt install -y procps \
&& apt install curl -y \
&& apt install inotify-tools -y \
&& apt install jo -y \
&& apt install jq -y \
&& apt install --upgrade unzip -y \
&& apt install gettext-base \
&& apt install bsdmainutils -y \
&& apt install translate-shell -y \
&& npm install --location=global npm -y \
&& npm install --location=global serve \
&& npm install -g npm-check \
&& cd /usr/local/bin \
&& curl https://getmic.ro | bash
RUN echo DefaultLimitNOFILE=65536 > /etc/systemd/system.conf
RUN echo DefaultLimitNOFILE=65536 > /etc/systemd/user.conf
RUN rm -rf package-lock.json \
&& npm install --legacy-peer-deps
我将其更改node:lts-bullseye-slim
为node:lts-bookworm-slim
,现在出现此错误:
sed:无法读取/etc/apt/sources.list:没有这样的文件或目录
我无法删除该行,因为在这种情况下我会收到此错误:
E:软件包“translate-shell”没有安装候选者
所以,我被困在这一点上。我应该怎么办?
答案1
您需要更改以下中的“组件”条目/etc/apt/sources.list.d/debian.sources
:
sed -i 's/^Components: main$/& contrib non-free/' /etc/apt/sources.list.d/debian.sources