首页 新闻 会员 周边 捐助

.NET 7 的 docker 镜像中如何将软件安装源替换为阿里云镜像源

0
悬赏园豆:30 [已解决问题] 解决于 2022-11-06 19:43

不替换的话,无法安装 curl

 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:7.0                                                                                                                                   1.3s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0 
...
 > [base 4/4] RUN apt-get update && apt-get install -y curl:                                                                                                                                                
#15 0.972 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB] 
...
#15 266.2 E: Failed to fetch http://deb.debian.org/debian/pool/main/b/brotli/libbrotli1_1.0.9-2%2bb2_amd64.deb  Connection timed out [IP: 151.101.110.132 80]
#15 266.2 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
------
executor failed running [/bin/sh -c apt-get update && apt-get install -y curl]: exit code: 100
dudu的主页 dudu | 高人七级 | 园豆:30948
提问于:2022-11-06 17:34
< >
分享
最佳答案
0

在 dockerfile 中添加下面的指令解决了

RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
dudu | 高人七级 |园豆:30948 | 2022-11-06 19:43
其他回答(1)
0

sed命令
参见https://stackoverflow.com/questions/62034545/dockerfile-how-to-set-apt-mirror-based-on-the-ubuntu-release

收获园豆:30
wdwwtzy | 园豆:114 (初学一级) | 2022-11-06 18:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册