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. [b0021] python 归纳 (七)_获得进程和线程信息

    # -*- coding: utf-8 -*- """ 获得线程, 进程 ID,NAME 总结: """ import threading ...

  2. Mybatis逆向工程中的 mybatis-generator:generate 代码生成器的使用

    使用逆向工程可以根据数据库的表名字生成pojo层(实体类),mapper层(dao层,直接与底层的XML中映射相关),XML(映射执SQL语句) 下面请看具体生成步骤 1. 点击generatorCo ...

  3. 在Rust中使用C语言的库功能

    主要是了解unsafe{}语法块的作用. #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] struct Complex { re: f32, im ...

  4. getpatch

    import time import os import math import sys import os,os.path,shutil import numpy as np import cv2 ...

  5. vim考场配置

    syntax on set number set mouse=a set autoread set showmatch set autoindent set smartindent set tabst ...

  6. ICCV

    ICCV 简介 ICCV 的全称是 IEEE International Conference on Computer Vision,即国际计算机视觉大会,由IEEE主办,与计算机视觉模式识别会议(C ...

  7. Vue v-for操作对象与数值

    <!doctype html> <html lang="en"> <head id="head"> <meta cha ...

  8. 【2019.7.20 NOIP模拟赛 T1】A(A)(暴搜)

    打表+暴搜 这道题目,显然是需要打表的,不过打表的方式可以有很多. 我是打了两个表,分别表示每个数字所需的火柴棒根数以及从一个数字到另一个数字,除了需要去除或加入的火柴棒外,至少需要几根火柴棒. 然后 ...

  9. 经典排序 python实现

    稳定的排序算法:冒泡排序.插入排序.归并排序和基数排序. 不是稳定的排序算法:选择排序.快速排序.希尔排序.堆排序. 冒泡 def bobble(arr): length = len(arr) for ...

  10. Paper | Blind Quality Assessment Based on Pseudo-Reference Image

    目录 1. 技术细节 1.1 失真识别 1.2 得到对应的PRI并评估质量 块效应 模糊和噪声 1.3 扩展为通用的质量评价指标--BPRI 归一化3种质量评分 判断失真类型 加权求和 2. 总结 这 ...