众所周知,Debian是linux发行版中官方源最难用的一个,这个傻逼源让我再构建docker镜像时卡了很久。

​ 那么能不能替换构建dockerfile时使用的源呢?显然是可以的

​ 在与Dockerfile同级的目录中准备一个sources.list(系统版本要对应,这里是Debian11),把里面的源换成比较快的国内源,另外版本代号也要跟镜像对应起来

Debian11(bullseye)的国内源(https://blog.csdn.net/weixin_48646819/article/details/120139802):

#http://mirrors.163.com/debian/为软件源也可以为其他的 bullseye为版本代号 main non-free contrib区别如下
deb http://mirrors.163.com/debian/ bullseye main non-free contrib deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib #deb http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib #deb http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib #deb-src http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib #deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib

在Dockerfile中,使用类似如下代码,在apt update之前替换掉软件源即可:

FROM debian:bullseye

# Add custom china source,ADD可将本地文件添加到镜像中,类似于具有root权限的cp命令
ADD sources.list /etc/apt/

在写dockerfile时替换国内源的更多相关文章

  1. pip 源 替换国内源

    网上收集来的pip源地址: 阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simp ...

  2. pip安装时使用国内源加快下载速度

    国内源: 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 h ...

  3. pip安装时使用国内源,加快下载速度

    国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.c ...

  4. ubuntu 替换国内源,清华源

    参考 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ Ubuntu 的软件源配置文件是 /etc/apt/sources.list.将系统自带的该文 ...

  5. PVE联网及更换国内源

    一.PVE联网 第一次安装PVE,正常情况下PVE的IP是在我们上网的网段的.没有网络有可能是没有配置DNS服务器地址或DNS地址是软路由网关地址.解决方法有3种: 1:设置DHCP自动获取网络地址和 ...

  6. dockerfile debian 和pip使用国内源

    python官方镜像是基于debian的.国内使用时定制一下,加快下载速度. 1 debian本身使用国内源 dockfile中: #国内debian源 ADD sources.list /etc/a ...

  7. 将raspberry 3B+的apt替换为国内源

    前段时间买了一块树莓派,想着自己拿来玩一下下(没什么钱烧更好的硬件,只能玩这个了,好在还够玩).于是就折腾起来,装了raspberry的系统. 这时候,因为默认apt是国外的源,在GFW这种神奇东西的 ...

  8. ubuntu18.04 apt-get换国内源 阿里源 163源 清华源 中科大源

    服务器上安装了最新的Ubuntu Server 18.04,代号为bionic.使用apt-get命令安装软件时,有时候速度比较慢,有时候会失败.因此考虑用国内的镜像源更换下apt-get的默认源. ...

  9. [转帖]centos7 使用kubeadm 快速部署 kubernetes 国内源

    centos7 使用kubeadm 快速部署 kubernetes 国内源 https://www.cnblogs.com/qingfeng2010/p/10540832.html 前言 搭建kube ...

  10. 在Kali linux下使用docker配置sqli-labs(国内源的配置和系统软件更新)

    本篇blog导航: ~前言 ~第一步:在安装好的kali配置国内源 ~第二步:安装docker ~第三步:docker下安装sqli-labs ~写在最后. 前言: 最近闲来无事,在闯关sqli-la ...

随机推荐

  1. [转帖]服务注册与发现:Nacos Discovery

    目录 一.概述 二.Nacos discovery--服务的注册与发现 1. 版本关系 2. 下载安装 (1)下载 (2)启动 (3)浏览器访问 三.Nacos服务注册与发现实战 1. 构建Sprin ...

  2. 【转帖】通过docker配置DNS服务

    https://blog.whsir.com/post-3185.html   在办公室开发人员经常会测试所写的页面,每次都要输入对应的IP地址或者更改hosts,为了让开发大爷省心,不如搭建一个dn ...

  3. vue3中context.emit遇见的坑

    场景描述 今天遇见一个问题 ,子组件向上抛出去的事件. 被执行了两次,原因是 context.emit('click', item.id) 你的事件名是click 将click更改为其他事件名称,就可 ...

  4. vue/cli3.0相对路径打包

    在项目下新增vue.config.js文件 module.exports={ productionSourceMap: false, publicPath: process.env.NODE_ENV ...

  5. 大模型应用开发:为产品创建一个AI客服/智能助手

    欢迎阅读本系列文章!我将带你一起探索如何使用OpenAI API来开发GPT应用.无论你是编程新手还是资深开发者,都能在这里获得灵感和收获. 本文将继续展示AI助手的开发方式,在OpenAPI中它的名 ...

  6. MySQL存储过程、索引、分表对比

    MySQL存储过程.索引和分表是用于提高查询效率的三种不同方法,它们各自对查询效率有不同的影响和应用场景.以下是它们的对比: MySQL存储过程: 影响查询效率: 存储过程通常不直接影响查询效率,因为 ...

  7. 6.4 Windows驱动开发:内核枚举DpcTimer定时器

    在操作系统内核中,DPC(Deferred Procedure Call)是一种延迟执行的过程调用机制,用于在中断服务例程(ISR)的上下文之外执行一些工作.DPC定时器是基于DPC机制的一种定时执行 ...

  8. 关闭表单验证/关闭控制台async-validator警告

    找到util.js node_modules -> async-validator -> es -> util.js 将console.warn(type, errors)注释 如果 ...

  9. Django后台输出原生SQL语句

    如果需要打印orm翻译后的原生sql语句,只需要在setting最后加上下面代码就行. 1 LOGGING = { 2 'version': 1, 3 'disable_existing_logger ...

  10. ubuntu16.04编译安装nginx1.24.0

    环境: Distributor ID: Ubuntu Description: Ubuntu 16.04.7 LTS Release: 16.04 Codename: xenial 安装包: pcre ...