Merge pull request #7448 from jmwong/patch-1

Update Docker Hub Github automated build instructions
This commit is contained in:
Justin I. Nevill 2018-10-02 11:27:23 -04:00 committed by GitHub
commit 2d5e5d47c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 42 deletions

View File

@ -11,29 +11,28 @@ skip to [Creating an Automated Build](github.md#creating-an-automated-build).
> *Note:*
> Automated Builds currently require *read* and *write* access since
> [Docker Hub](https://hub.docker.com) needs to set up a GitHub service
> hook. We have no choice here, this is how GitHub manages permissions.
> [Docker Hub](https://hub.docker.com) needs to set up a GitHub webhook.
> We have no choice here – this is how GitHub manages permissions.
> We do guarantee nothing else is touched in your account.
To set up an Automated Build of a repository on GitHub, you need to
link [Docker Hub](https://hub.docker.com/account/authorized-services/) to your
GitHub account. This allows the registry to see your GitHub repositories.
To add, remove or view your linked account, go to the "Linked Accounts &
Services" section of your Hub profile "Settings".
To add, remove or view your linked account, log in to your Docker Hub account. Select **Settings > Linked Accounts & Services**.
![authorized-services](images/authorized-services.png)
When linking to GitHub, select either "Public and Private",
or "Limited Access" linking.
When linking to GitHub, select either ***Public and Private***,
or ***Limited Access***.
![add-authorized-github-service.png](images/add-authorized-github-service.png)
The "Public and Private" option is the easiest to use, as it grants the Docker
The ***Public and Private*** option is the easiest to use, as it grants the Docker
Hub full access to all of your repositories. GitHub also allows you to grant
access to repositories belonging to your GitHub organizations.
If you choose "Limited Access", Docker Hub only gets permission to access your
If you choose ***Limited Access***, Docker Hub only gets permission to access your
public data and public repositories.
Follow the onscreen instructions to authorize and link your GitHub account to
@ -43,30 +42,30 @@ which to create the Automatic Build.
You can review and revoke Docker Hub's access by visiting the
[GitHub User's Applications settings](https://github.com/settings/applications).
> **Note**: If you delete the GitHub account linkage that is used for one of your
> automated build repositories, the previously built images are still available.
> **Note**: If you delete the connection to the GitHub account that is used for one of your
> automated build repositories, previously built images are still available.
> If you re-link to that GitHub account later, the automated build can be started
> using the "Start Build" button on the Hub, or if the webhook on the GitHub repository
> using the **Start Build** button on the Hub, or if the webhook on the GitHub repository
> still exists, it is triggered by any subsequent commits.
## Auto builds and limited linked GitHub accounts.
## Auto builds and limited linked GitHub accounts
If you selected to link your GitHub account with only a "Limited Access" link,
then after creating your automated build, you need to either manually
trigger a Docker Hub build using the "Start a Build" button, or add the GitHub
webhook manually, as described in [GitHub Service
Hooks](github.md#github-service-hooks). This only works for repositories
under the user account, and adding an automated build to a public GitHub
organization using a "Limited Access" link is not possible.
If you chose ***Limited Access*** for your Github account connection, after creating your automated build,
you will need to either:
* Manually trigger a Docker Hub build using the **Start a Build** button, or
* Add the GitHub webhook manually, as described in [GitHub Webhook](github.md#github-webhook).
This only works for repositories under the user account, and adding an automated build to a public GitHub
organization using a ***Limited Access*** link is not possible.
## Changing the GitHub user link
If you want to remove, or change the level of linking between your GitHub
account and the Docker Hub, you need to do this in two places.
account and the Docker Hub, you need to make the change in two places.
First, remove the "Linked Account" from your Docker Hub "Settings". Then go to
your GitHub account's Personal settings, and in the "Applications" section,
"Revoke access".
First, remove the **Linked Account** from your Docker Hub **Settings**. Then go to
your GitHub account's Personal settings, and in the **Applications** section,
***Revoke access***.
You can now re-link your account at any time.
@ -76,20 +75,20 @@ GitHub organizations and private repositories forked from organizations are
made available to auto build using the "Docker Hub Registry" application, which
needs to be added to the organization - and then applies to all users.
To check, or request access, go to your GitHub user's "Setting" page, select the
"Applications" section from the left side bar, then click the "View" button for
To check, or request access, go to your GitHub **Settings** page, select the
**Applications** section from the left side bar, then click the **View** button for
"Docker Hub Registry".
![Check User access to GitHub](images/gh-check-user-org-dh-app-access.png)
The organization's administrators may need to go to the Organization's "Third
party access" screen in "Settings" to grant or deny access to the Docker Hub
The organization's administrators may need to go to the Organization's **Third
party access** screen in **Settings** to grant or deny access to the Docker Hub
Registry application. This change applies to all organization members.
![Check Docker Hub application access to Organization](images/gh-check-admin-org-dh-app-access.png)
More detailed access controls to specific users and GitHub repositories can be
managed using the GitHub "People and Teams" interfaces.
managed using the GitHub **People and Teams** interfaces.
## Creating an Automated Build
@ -178,26 +177,36 @@ build.
</tbody>
</table>
## GitHub service hooks
## GitHub webhook
A GitHub Service hook allows GitHub to notify the Docker Hub when something has
A GitHub webhook allows GitHub to notify the Docker Hub when something has
been committed to a given git repository.
When you create an Automated Build from a GitHub user that has full "Public and
Private" linking, a Service Hook should get automatically added to your GitHub
When you create an Automated Build from a GitHub user that has full **Public and
Private** linking, a Service Hook should get automatically added to your GitHub
repository.
If your GitHub account link to the Docker Hub is "Limited Access", then you
need to add the Service Hook manually.
If your GitHub account link to the Docker Hub is **Limited Access**, then you
need to add the webhook manually.
To add, confirm, or modify the service hook, log in to GitHub, then navigate to
the repository, click "Settings" (the gear), then select "Webhooks & Services".
You must have Administrator privileges on the repository to view or modify
this setting.
To add, confirm, or modify the webhook, log in to GitHub, then navigate to
the repository. Within the repository, select **Settings > Webhooks**.
You must have admin privileges on the repository to view or modify
this setting. Click **Add webhook**, and use the following settings:
The image below shows the "Docker" Service Hook.
![bitbucket-hooks](images/github-side-hook.png)
| Field | Value |
| ------|------ |
| Payload URL | https://registry.hub.docker.com/hooks/github |
| Content type | application/json |
| Which events would you like to trigger this webhook? | Just the push event |
| Active | checked |
The image below shows the **Webhooks/Add webhook** form with the above settings reflected:
![github-webhook-add](images/github-webhook-add.png)
If configured correctly, you'll see this in the **Webhooks** view
![github-webhook](images/github-webhook.png)
If you add the "Docker" service manually, make sure the "Active" checkbox is
selected and click the "Update service" button to save your changes.

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB