在创建 kubernetes 集群时需要一些 Google 云上的镜像
国内拉取不了 Google 云上的镜像, 所以我们想到了阿里云, 因为阿里云服务器在美国, 所以我们去阿里云上的构建镜像的功能拉取国外的镜像, 然后再从阿里云上拉取到本地
话不多说行动起来
登陆阿里云
找到容器服务
点击管理控制台
点击创建镜像仓库
填写仓库信息
这里如果没有绑定 GitHub, 先去绑定, 点击绑定账号, 跳转到 GitHub, 点击一下就 ok,
命名空间选择 GitHub 账号就行, 仓库名写你的 dockerfile 存放的仓库名, 没有先去创建 . 我的仓库内容如下图, 大家也可以 follow 我复制我的仓库.
https://github.com/LIUXUCHONG/dockerlibrary
其中 images 文件夹下是 dockerfile 目录
每个目录下有一个 dockerfile 拉取指定镜像
选中 GitHub, 这里利用 GitHub 上的 dockerfile 创建, 也可以选择其他, 勾选上海外及其构建.
然后会生成一个镜像仓库 kubernetes2
这里我用我原先创建好的 kubernetes 仓库演示
点击你的仓库名称, 然后弹出如下页面, 点击构建, 添加规则.
根据要求填写
点击确认然后出现一条规则, 点击立即创建
然后等待一小会, 阿里云仓库就会多了一个 pause 版本的镜像
其他镜像在原来的规则上修改在构建即可
然后查看镜像版本
然后点击左上角基本信息
这里告诉了我们如何拉取阿里云仓库上的镜像
首先回到本地机器登陆阿里云的仓库
- [[email protected] yum.repos.d]# docker login --username=< 你的名字 > registry.cn-hangzhou.aliyuncs.com
- Password:
- WARNING! Your password will be stored unencrypted in /root/.docker/config.JSON.
- Configure a credential helper to remove this warning. See
- Login Succeeded
- [[email protected] yum.repos.d]#
注意这里的密码并不是你阿里云的登陆密码, 而是你开通服务时的密码
接下来拉取镜像并重新 tag
[[email protected] ~]# docker pull registry.cn-hangzhou.aliyuncs.com/aliyunlxc/kubernetes:pause pause: Pulling from aliyunlxc/kubernetes 7675586df687: Pull complete Digest: sha256:fcaff905397ba63fd376d0c3019f1f1cb6e7506131389edbcb3d22719f1ae54d Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/aliyunlxc/kubernetes:pause [[email protected] ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry.cn-hangzhou.aliyuncs.com/aliyunlxc/kubernetes pause da86e6ba6ca1 17 months ago 742kB [[email protected] ~]# [[email protected] ~]# docker tag registry.cn-hangzhou.aliyuncs.com/aliyunlxc/kubernetes:pause k8s.gcr.io/pause:3.1[[email protected] ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE k8s.gcr.io/pause 3.1 da86e6ba6ca1 17 months ago 742kB registry.cn-hangzhou.aliyuncs.com/aliyunlxc/kubernetes pause da86e6ba6ca1 17 months ago 742kB [[email protected] ~]#
其余镜像类似
来源: http://www.bubuko.com/infodetail-3066627.html