资讯专栏INFORMATION COLUMN

替换 Docker 或 Laradock 中 Debian 系统镜像源解决软件安装问题

laznrbfe / 1480人阅读

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

Docker Debian 镜像源替换

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

163 - Debian

Aliyun - Debian

注意: 不同版本的 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

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

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/27815.html

相关文章

  • 记一次Docker构建失败

    摘要:之所以在本地构建,而没有使用仓库的,是因为,我们的镜像采用了国内阿里云的源,再加上某些很奇妙的网络因素,在中自动构建时,升级总会失败。然而,在本地再次构建成功。 见字如晤。 前段时间,Node.js 官方发布了Node 8.9.3 LTS版本,并且官网首页提示新版本有重要安全更新,Important security releases, please update now! ,然后我立...

    joyqi 评论0 收藏0
  • docker 应用系列(一)--- 一步步搭建虚拟机 docker 环境 附有 vue-cli +

    摘要:为确保系统里面没有自带的软件的残留,我们要清除一下旧版本的,虽然新系统一般都不会有就是了。更新软件包缓存。 showImg(https://segmentfault.com/img/remote/1460000015914895?w=1240&h=819); 小剧场 测试:裤裆你这页面刷新就白屏啊,怎么了啊,而且你看这 network,怎么这些 js 这么大啊,很耗流量而且加载速度还很...

    hatlonely 评论0 收藏0
  • 基于Debian系统安装node运行环境(docker、canvas)

    摘要:第三步,安装,上官网,获取的安装包下载链接,用以下命令进行下载及安装。第四步,设置正确的时区显示时区信息生成选定时区配置文件新时区设置生效网络对时需安装第五步,生成镜像基础环境已经安装完成,退出容器,生成镜像即大功告成。 以前的软件部暑的docker镜像一直用ubuntu14.04来制作的,综合考虑,决定将系统切换到debian8.7(stable)下。 难点 因为我们的系统使用了ca...

    li21 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<