I. Background INTRODUCTION
As we all know, due to the domestic network reasons, in the construction of kubernetes environment, often encountered the need for the mirror can not find the situation.
After all, it is not a good idea to pick up rubbish in Dockerhub, this article teaches everyone to build their own mirror warehouse in Dockerhub.
Request: Have GitHub account number, have dockerhub account number, do not register.
Second, the basic steps
2.1 Login GitHub, create code warehouse, such as: Googlecontainer
2.2 Cloning code (address for your)
# git clone https://github.com/SataQiu/googlecontainer.git
2.3 Writing Dockerfile (take dashboard as an example)
# CD Googlecontainer
# mkdir Dashboard
# CD Dashboard
# Vim Dockerfile
From gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.1
maintainer qiushida@buaa.edu.cn
2.4 Submitting Code
# cd < clone code root directory >
# git Add.
# git commit-m "kubernetes-dashboard-amd64:v1.7.1"
# git push
2.5 The code structure after the final commit is completed
2.6 Login Dockerhub, create automated build project
If not associated with the account, will be prompted to bind GitHub account, as prompted to operate.
If the GitHub is bound, select the automated build project in GitHub mode, as shown in
Then follow the prompts, select GitHub on our project Googlecontainer can, the warehouse name set to Dashboard
2.7 Configuration Build Settings
Specify the directory in which Dockerfile is located (to the directory level), set the mirror tag, click Save Changes, and then click Trigger
2.8 In Build Details can view the compilation progress
2.9 After the compilation completes, we can pull the mirror to the local.
Change your own tag is gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.1 mirror image.
# Docker Pull shidaqiu/dashboard:v1.7.1
# docker tag shidaqiu/dashboard:v1.7.1 gcr.io/google_containers/ kubernetes-dashboard-amd64:v1.7.1