I pushed a container onto my project in docker registry hub,
there are two tabs Information and Tags,
how could I add the Information for my container ?
The information tab is filled when you set up an auto build that builds a Dockerfile that is hosted on your github account. It simply takes the README.md contents of your github project.
The tags tab is filled when you configure your auto build to assign tags to different branches of your github project.
As an example please have a look at this docker hub page and this github project.
Related
I have a repository on DockerHub, which I have configured to hook up directly with my GitHub repo, so that a git commit will trigger the build of the Docker images.
I am looking to build multiple Docker images (e.g. v1, v2 etc) for my product.
Now, I can see that DockerHub gives you the option to configure the "build rules" directly from the portal:
so right now, when I make changes to the /releases/v1/Dockerfile, the build will be triggered automatically.
Cool.
Going forward however, I expect to release /releases/v2/Dockerfile to my GitHub repo, and I would like for v2 to be built automatically as well, without me having to create the "build rule" manually. Is there a way to create a "build rule" programmatically?
I'm looking to call the DockerHub API to create the build rule.
I've been through the documentation of the API here
https://docs.docker.com/registry/spec/api/
but I couldn't find what I was after.
I would like to end up with:
where v2 was created programmatically and not from the console.
Docker Hub is following the git conventions where you wouldn't normally put different versions of the application in the same git commit. Instead, you would use separate branches and tags for different versions of your code. If you follow that git convention, then you can tag your resulting image based on the regex on the branch or tag. E.g.
Source Type: Branch
Source: /^v([0-9.]+)$/
Docker Tag: v{\1}
Then you can build within a branch called v1.1 (or any other version number) and the docker image will be tagged v1.1. To pull out just the first number of the tag, that would look like:
Source Type: Tag
Source: /^v([0-9]+)[0-9.]*$/
Docker Tag: v{\1}
Which would convert a tag with a version number like v10.1.2 into a docker tag of v10 (only numbers before the . are matched in the first part of the regex).
For more details on their build rules, see:
https://docs.docker.com/docker-hub/builds/#set-up-build-rules
Regarding the API, while the registry itself has a documented API, and Hub has an API for Hub in beta, neither of these exposes the build settings. You could try to capture the calls by sniffing the browser traffic and replicating it in your app, but Docker could modify those calls at any time since they don't support an API for that.
So I have an application called SongKong, I wanted to build a Docker image for it. Within hub.docker.com you can link to a repository containing Dockerfile and build from it, I do not want to call this repos songkong because I already have a songkong repo for the actual application code. So I called the repo songkongdocker but now my hub.docker.com repo is called songkongdocker, it would seem that hub.docker repos are usually named after the application so ideally should just be songkong
So, what is the correct way to name and can my Bitbucket code repository have a different name then the hub.docker.com repository ?
You can change build/repo name when you are creating an Automated build on hub.docker.com. Bitbucket/Github repo name is used as a default name, but you can still edit it.
I am quite newbie in docker, and I am trying to find the way to tell version for a docker hub tagged image.
For instance, the jenkins/jenkins:lts-latest image, listed here https://hub.docker.com/r/jenkins/jenkins/tags/, what image version does actually aliase? And how can I infer the correspondent dockerfile/branch in jenkins repo?
I tried with docker search but I couldn't. I tried also to find a clue in the official Jenkins github dockerfile repo: https://github.com/jenkinsci/docker, but I don't see any bindung tag or anything that gives me a hint on the source of the image
Another example, I have a Kubernetes cluster, and when I check my Nexus pod, I see likewise that the image is defined as sonatype/nexus3:latest.
In this case at least I have the imageID: docker-pullable://sonatype/nexus3#sha256:434a2564aa64646464afaf.. but once again I don't know how to map it to the actual version of the software
For the repo you asked, the answer is No.
When setup repo on dockerhub, there are two kinds of options for user to choose as follows:
1) Create Repository:
In this way, dockerhub just create a repo for user, and user need to build his own image on local server, tag it, and push it to dockerhub.
When user push his image to dockerhub, no additional information about the source version will be appended, so can't get any source map from dockerhub.
jenkins/jenkins, just this kind of repo.
2) Create Automated Build
In this way, dockerhub will fetch the code from github or bitbucket, and build the image on its cloud infrastructure, so it will know exactly what source commit is for current docker image.
jenkins/jnlp-slave, just this kind of repo.
Then, you can click its Build Details on the web page, click into one link, e.g. 3.26-1-alpine, you will see log mentioned 0a0239228bf2fd26d2458a91dd507e3c564bc7d0 is the source commit.
To sum up, for the repo you mentioned in the question, they are not Automated Build, so you cannot get the map for the image & source code, but if you happen to find a repo in dockerhub which is Automated Build later & want to know the map, then you can.
As long as I understand your question, you are trying to tag the docker image exact with same version as of your software version. For that I use to create image tag:
$ export VERSION="2.31-b19"
$ docker tag "<user>/<image>:${VERSION}" "<docker_hub_user>/<repo>:latest"
If this is not the case. Please explain your use case a bit more so that we can provide you a better workaround.
I have a personal account, on Docker Hub, linked to my GitHub account, where I can build an image of my repository normally.
Now I've created an organization on GitHub where I've forked my code. I've also created an organization on Docker Hub using my personal account, and created a repository in this organization. But I can't seem to figure out how to trigger a build in this repository!
I don't have access to the same menus, I don't know what I'm missing here. Any clue? Thanks.
I think you have to create an 'Automated build', not a simple repository.
In the top left of the UI, go to 'Create' > 'Create Automated Build', then select Github or Bitbucket, select the source repository, then for the 'Repository Namespace & Name' I guess that you should be able to choose your organization for the namespace.
Of course you have to deleted the simple repository you created if you want to use the same repository name.
I want to keep the images that I used in my docker hub account while maintaining reference to the pulled image. Something like when you fork a project in github.
Currently I have tried jwilder/nginx-proxy image. Now that I am satisfied with it, I committed the working container to username/nginx-proxy image and push it.
The problem with this approach is it is like a fresh image and it doesn't show the layer from jwilder/nginx-proxy. No documentation or even Dockerfile.
If you push the image, there is no reference to the original, that behavior is normal. You can put that reference or link using your "repo info".
The Dockerfile is only shown if you did an automated build linking your github or bitbucket account and the push is automatically done based on the Dockerfile of your project.