本文是通过 github 上创建 Dockerfile, 编写拉取 google container registry 里面的镜像.
用 dockerHub 的自动构建功能, 连接 github 仓库触发构建的 Dockerfile 文件, 生产所要的镜像.
由于被墙的原因, 比如, 在构建 kubelet 源代码时, 需要拉取 gcr.io image 文件, 那就需要自己去 google 拉下来:
[root@shtl009036086 build]# ./run.sh hack/build-go.sh cmd/kubelet
通过 github 的 dockerfile 来制作镜像, 先上 google 的 Container Registry 容器仓库查询并且确认所需镜像和他的 tag
查询 google Container Registry
https://console.cloud.google.com/gcr/images/google-containers?project=google-containers
访问 github
https://github.com/zhuning73/make-gcr-io
创建 / make-gcr-io 仓库文件夹, 创建 Dockerfile 文件
创建目录: make-gcr-io/kube-cross/v1.10.1-1/Dockerfile
https://github.com/zhuning73/make-gcr-io/blob/master/kube-cross/v1.10.1-1/Dockerfile
访问 docker hub
https://hub.docker.com/
创建自动构建功能,
关联 github 账户, 选择对应仓库
配置 github 上的 dockerfile 目录地址
可以看到, success 状态
docker 执行拉取操作:
docker pull zhuning/kube-cross:v1.10.1-1
下载成功后, 通过 docker tag 创建想要的 images, 回到最上面的过程, kube-cross 创建完成
[root@shtl009036086 build]# docker tag zhuning/kube-cross:v1.10.1-1 k8s.gcr.io/kube-cross:v1.10.1-1
来源: https://yq.aliyun.com/articles/582477