ubuntu安装docker

2020-02-03  本文已影响0人  Am0s

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

更新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
  1. vi /etc/docker/daemon.json (注意第一次修改或没修改过镜像配置文件的话,这个文件是不存在的,直接新建即可)
  2. 输入内容
{
  "registry-mirrors": ["https://y0qd3iq.mirror.aliyuncs.com"]
}
  1. 重启服务
    service docker restart
  2. 验证是否生效
    docker info|grep Mirrors -A 1
    如果看到https://y0qd3iq.mirror.aliyuncs.com 说明生效。
上一篇下一篇

猜你喜欢

热点阅读