Docker Debian 镜像源替换

因多数默认的 Docker 镜像为国外的,而采用的镜像源也是国外的,故访问很慢,所以我们需要替换为国内的(比如阿里云或163等)。

注意: 不同版本的 Debian 镜像源地址不一样

Debian 7.x (wheezy)

# 更新apt-get源
RUN echo \
deb http://mirrors.aliyun.com/debian/ wheezy main non-free contrib\
deb http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ wheezy main non-free contrib\
> /etc/apt/sources.list

Debian 8.x (jessie)

# 更新apt-get源
RUN echo \
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib\
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib\
> /etc/apt/sources.list

Debian 9.x (stretch)

# 更新apt-get源
RUN echo \
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib\
deb http://mirrors.aliyun.com/debian-security stretch/updates main\
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main\
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib\
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib\
> /etc/apt/sources.list

Laradock 镜像构建失败

因为默认用的是国外 Debian 镜像源,故在执行 apt-get 等命令拉取软件包时会失败,我们需手动在对于的 Dockerfile 中添加一个 RUN 指令来替换掉默认的镜像源

以下仅为示例:

需根据自己当前 Laradock 版本查看引用的系统镜像及其版本注意不同,其他系统(eg: CentOS)请对症下药。

# 更新apt-get源
RUN echo \
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib\
deb http://mirrors.aliyun.com/debian-security stretch/updates main\
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main\
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib\
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib\
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib\
> /etc/apt/sources.list

感谢您的阅读,觉得内容不错,点个赞吧

替换 Docker 或 Laradock 中 Debian 系统镜像源解决软件安装问题的更多相关文章

  1. Android中调用系统所装的软件打开文件(转)

    Android中调用系统所装的软件打开文件(转) 在应用中如何调用系统所装的软件打开一个文件,这是我们经常碰到的问题,下面是我所用到的一种方法,和大家一起分享一下! 这个是打开文件的一个方法: /** ...

  2. Ubuntu16.04系统美化、常用软件安装等,长期更新

    Ubuntu16.04系统美化.常用软件安装等,长期更新 IT之家啊 18-09-0915:00 因为我个人偏向于玩VPS.服务器之类的东西,所以一般我都是用CentOS.不过对于桌面版的Linux, ...

  3. maven更换下载镜像源-解决下载慢问题(转)

    转自:http://www.cnblogs.com/duking1991/p/6110192.html maven更换下载镜像源-解决下载慢问题   Maven是当前流行的项目管理工具,但官方的库在国 ...

  4. 无法更新apt镜像源?树莓派安装最新版Debian11(bullseye)arm64位系统步骤

    镜像下载.域名解析.时间同步请点击阿里云开源镜像站 树莓派系统在2022年1月28日迎来了更新,更新了64位的系统,同时也有lite系统供我们使用.32位系统很多软件都用不了,特别是宝塔面板.下面是安 ...

  5. docker/kubernetes国内源/镜像源解决方式

    最近在使用kubeadm时,被各种连接不上搞到崩溃.费了很多力气,基本都解决了.这里统一整理了国内的一些镜像源,apt源,kubeadm源等,以便查阅. 国内镜像源 Azure China提供了目前用 ...

  6. Centos6 系统下源码方式安装Mysql 记录

    在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配. #### ...

  7. Jenkins 插件使用国内镜像源-解决插件下载慢的问题

    问题 我们在Jenkins里面经常会遇到安装插件很慢,这是由于我们使用的是更新中心镜像默认为国外的源.现在我们可以进行设置为国内镜像源,来解决安装插件慢的问题. 解决办法 安装插件localizati ...

  8. 更换国内镜像源进行pip安装

    Linux中当我们需要安装某个模块时(比如tensorflow2.0.0),常见有三种方法: pip install tensorflow==2.0.0 pip install https://pyp ...

  9. pip命令使用国内pypi镜像源加速在线安装

    参考:http://www.cnblogs.com/yudar/p/4444097.html 用easy_install和pip来安装第三方库很方便 它们的原理其实就是从Python的官方源pypi. ...

随机推荐

  1. linux系统管理-输入输出

    目录 linux系统管理-输入输出 参数传递xargs linux系统管理-输入输出 重定向 将原本要输出到屏幕上的数据信息,重新定向到指定的文件中 运行程序,或者输入一个命令:默认打开4个文件描述符 ...

  2. OceanBase 架构初探

    OceanBase 架构初探 原创衣舞晨风 发布于2018-11-13 08:44:14 阅读数 1417  收藏 展开 1.设计思路 OceanBase的目标是支持数百TB的数据量以及数十万TPS. ...

  3. securecrt如何保存操作日志

  4. CodeForces - 1253C(思维+贪心)

    题意 https://vjudge.net/problem/CodeForces-1253C n个糖果,一天最多吃m个糖果,每个糖果有个值a[i],第d天会变成d*a[i],问吃k(k=1~n)个糖果 ...

  5. Bn Bp Binder native层关系

    Servicemanager 源码在/frameworks/base/cmds/servicemanager/service_manager.c 编译成 systemmanager 可执行文件 sys ...

  6. linux学习(二)linux系统的安装

    Linux 安装 本章节我们将为大家介绍 Linux 的安装,安装步骤比较繁琐,现在其实云服务器挺普遍的,价格也便宜,如果直接不想搭建,也可以直接买一台学习用用,参考各大云服务器比较. 本章节以 ce ...

  7. Maven中使用tomcat:run出现错误org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException

    配置是正常的.查阅资料以后说是jdk版本什么的问题.多方修改没有任何改观.换一个思路去查询tomcat:run怎么运行. 是因为他还是沿用了上一次的tomcat插件(默认是6)所以运行的时候使用 to ...

  8. day71_10_16多表断关联

    ---恢复内容开始--- 本次环境: 配置settings INSTALLED_APPS = [ # ... 'rest_framework', ] DATABASES = { 'default': ...

  9. jQuery中的筛选(六)

    1. eq(index|-index) 获取当前链式操作中第N个jQuery对象,返回jQuery对象,当参数大于等于0时为正向选取,比如0代表第一个,1代表第二个.当参数为负数时为反向选取,比如-1 ...

  10. 端口转发之 nc

    nc使用方法: Ncat 7.50 ( https://nmap.org/ncat ) Usage: ncat [options] [hostname] [port] Options taking a ...