Allow GitHub to bind to the Docker Hub Docker hub->create->create automated build for the first time this step requires GitHub authorization. will automatically jump to GitHub consent authorization.
Create a Docker build project on the GitHub to implement dockerfile inside. This step can be done locally and then submitted to your own GitHub warehouse.
Then proceed to the first step and select the build warehouse in GitHub on the right:
Push update, auto build whenever dockerfile new changes are pushed to the GitHub build warehouse, the Docker hub is automatically built here.
Based on the tag of the push in the default build, each push code, build a new version of the latest build. It is not convenient to control the version of the Mirror. The best way to do this is to build a latest version image based on a push submission, and build a mirror of the specified version based on the tag's submission. First, set these two constructs in the Docker hub:
There are two ways to set this up, and when the new commit is pushed GitHub, the branch will be triggered, creating a latest version. When the new tag is pushed to GitHub, the tag will be triggered to build a tag version.
Push tag to GitHub "Don't forget to add, commit, push code first." And then do the tag thing. "Execute the following git command to push a tag to git server:
Make a tag,tag version of the latest commit for 1.6. The version of the Mirror that is built is also 1.6 git tag-a 1.6-m "message"
Push the local tag to the remote. Git push Origin--tags
After completing the above steps, the Docker hub will be built two times separately based on the submission of the Code and the submission of tag. The two builds are latest, 1.6, respectively.
In this way of automatic construction, we don't need to build the mirror manually, or maintain the version number of the mirror manually docker. Of course, when pushing Dockerfile, it is best to pass the test locally. Later versions, mirroring control, are given to git and Docker hub. So we can pull the mirror from the Docker hub very quickly on any machine.
Case Tomcat-centos Mirror GitHub address: https://github.com/chenyufeng1991/tomcat-centos-dockerfile Tomcat-centos mirroring Docker Hub Address: https://hub.docker.com/r/chenyufeng/tomcat-centos/
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.