2018-03-23 Docker安装和配置国内镜像


1、安装环境

Mac 10.13.3
Docker 17.09.0-ce-mac35 (19611)
Virtualbox 5.2.8

2、安装docker

download docker community edition
下载到本地后直接双击安装。

3、安装Virtualbox

download virtualbox
下载到本地后直接双击安装。

4、配置国内镜像

docker默认是国外的服务器拉数据,基本访问不了,需要配置国内的docker镜像。

有很多镜像可以使用,例如 dao阿里云docker镜像等等
因为我开通了阿里云的账户,所以就不再使用其他镜像了。

阿里云会给每个人配备一个专属的加速器地址,类似

https://xxxxxx.mirror.aliyuncs.com

备用:

https://registry.docker-cn.com/

然后根据下面的操作文档进行配置:
1. 创建一台安装有Docker环境的Linux虚拟机,指定机器名称为default,同时配置Docker加速器地址。

➜ ~ docker-machine create --engine-registry-mirror=https://xxxxxx.mirror.aliyuncs.com -d virtualbox default

Running pre-create checks...
Creating machine...
...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default

另一种办法是找到 daemon.json 文件,一般在 /etc/docker/ 或者 ~/.docker/ 目录下,修改为:

{
  "registry-mirrors" : [
    "https://xxxxxx.mirror.aliyuncs.com"
  ]
}
  1. 查看机器的环境配置,并配置到本地,并通过Docker客户端访问Docker服务。
docker-machine env default
eval "$(docker-machine env default)"
  1. 查看docker相关信息
docker info

或者,如果使用 Docker for Mac,直接在Preferences里进行配置,如下图:
配置docker镜像.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值