ubuntu镜像地址:http://mirrors.ustc.edu.cn/ubuntu-releases/16.04/
安装的为ubuntu16.04
更新源
先更新源 vi /etc/apt/source.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
然后执行apt-get update
安装docker
- 先安装https和ca证书
sudo apt-get install apt-transport-https ca-certificates - 添加一个新的GPG密钥
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys - 重新更新包
apt-get update - 启动docker
service docker start
至此安装完毕,可以运行helloworld验证一下
docker run hello-world
更新docker源
docker默认使用的是国外源,有时候很卡,甚至连不上,需要将源更换为国内
几个国内源
Docker 官方中国区:https://registry.docker-cn.com
网易:http://hub-mirror.c.163.com
中国科技大学:https://docker.mirrors.ustc.edu.cn
阿里云:https://y0qd3iq.mirror.aliyuncs.com
- 更新docker源
- vi /etc/docker/daemon.json (注意第一次修改或没修改过镜像配置文件的话,这个文件是不存在的,直接新建即可)
- 输入内容
{
"registry-mirrors": ["https://y0qd3iq.mirror.aliyuncs.com"]
}
- 重启服务
service docker restart - 验证是否生效
docker info|grep Mirrors -A 1
如果看到https://y0qd3iq.mirror.aliyuncs.com 说明生效。
网友评论