美文网首页
docker中ubuntu镜像的软件源问题

docker中ubuntu镜像的软件源问题

作者: 骚伦 | 来源:发表于2018-06-07 22:55 被阅读0次

问题:使用docker 利用下载的ubuntu镜像启动容器时,使用的源下载更新软件的速度较慢。

解决这个问题的方法是跟新ubuntu容器的源

示例:以ubuntu为基础镜像

1)启动一个名称为 test02的容器,并且开启shell交互(/bin/bash )

# docker run -ti --name test02   ubuntu /bin/bash 

2)用自带vi修改源

root@e330db11c513:/# vi /etc/apt/sources.list

将原有内容删除,并替换为以下的阿里源

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

3)更新源

sudo apt-get clean

sudo apt-get update

相关文章

网友评论

      本文标题:docker中ubuntu镜像的软件源问题

      本文链接:https://www.haomeiwen.com/subject/hqnnsftx.html