“利用Dockerfile修改容器中的apt源(debian源)”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
→‎1
→‎good
 
(未显示同一用户的7个中间版本)
第3行: 第3行:
 
=1=
 
=1=
 
<pre>
 
<pre>
 +
eg # 用@ 非常 不错 好过 !
 +
 +
sed -i "[email protected]@163.com@g" sources.list
 +
sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
 +
sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
 +
 +
 +
 
  RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
 
  RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
 
RUN  apt clean
 
RUN  apt clean
 
RUN apt update </pre>
 
RUN apt update </pre>
 +
 
=2=
 
=2=
 
<pre>
 
<pre>
 +
#10 163 rep  喜欢这个
 +
echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib
 +
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
 +
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
 +
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
 +
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
 +
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
 +
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
 +
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib'>/etc/apt/sources.list
 +
   
 +
 +
 +
 +
 +
 
#apt-get源 使用aliyun的源
 
#apt-get源 使用aliyun的源
 
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bakevan && \     
 
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bakevan && \     
     echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >/etc/apt/sources.list && \
+
     echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >/etc/apt/sources.list && \
+
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
     echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >/etc/apt/sources.list && \
+
     echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
     echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >/etc/apt/sources.list && \
+
     echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
     echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >/etc/apt/sources.list && \
+
     echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >/etc/apt/sources.list && \
+
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
     echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >/etc/apt/sources.list && \
+
     echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list && \
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >/etc/apt/sources.list  
+
     echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list  
  </pre>
 
  
=2=
+
 
 +
 
 +
 
 +
</pre>
 +
 
 +
=good=
 
<pre>
 
<pre>
   
+
# 163 这个不通了 2024 
 +
#wget  -c  http://mirrors.163.com/.help/sources.list.stretch
 +
cp sources.list.stretch sources.list #在Dockerfile 同一个目录
 +
 
 +
 
 +
 
 
# Add custom china source   
 
# Add custom china source   
 +
 +
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
 +
RUN rm -f /etc/apt/sources.list
 +
RUN rm -f /etc/apt/sources.list.d/mssql-release.list
 +
COPY  sources.list /etc/apt/
 +
#RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
 +
RUN  apt clean
 +
RUN apt update  -y
 +
RUN  apt clean
 +
RUN  apt install -y  apt-transport-https
 +
RUN apt install -y cron vim
 +
 +
 +
#这个太温和了
 
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak  
 
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak  
 
ADD  sources.list /etc/apt/ && apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
 
ADD  sources.list /etc/apt/ && apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

2024年10月22日 (二) 16:52的最新版本

由于众所周知的原因 默认的debian是用了官网的源,在天朝就非卡 所以 有时就得改一下源喽

1

eg # 用@ 非常 不错 好过 !

sed -i "[email protected]@163.com@g" sources.list
sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list 



 RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN  apt clean
RUN apt update 

2

#10 163 rep  喜欢这个 
echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib'>/etc/apt/sources.list
    





#apt-get源 使用aliyun的源
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bakevan && \    
    echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list 




good

 # 163 这个不通了 2024   
#wget  -c  http://mirrors.163.com/.help/sources.list.stretch
cp sources.list.stretch sources.list #在Dockerfile 同一个目录



# Add custom china source  

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak 
RUN rm -f /etc/apt/sources.list 
RUN rm -f /etc/apt/sources.list.d/mssql-release.list 
COPY  sources.list /etc/apt/
#RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN  apt clean 
RUN apt update  -y 
RUN  apt clean 
RUN  apt install -y  apt-transport-https
RUN apt install -y cron vim 


#这个太温和了 
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak 
ADD  sources.list /etc/apt/ && apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll