-
Notifications
You must be signed in to change notification settings - Fork 228
Add docs for Registry Credentials #564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+149
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a781068
Add docs for Registry Credentials
sethboyles 3171697
Minor editorial changes
anita-flegg 713d7f5
various VMware style edits
anita-flegg 7f01525
Address comments
sethboyles b24b08c
OrgManagers cannot create/edit space credentials
sethboyles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
--- | ||
title: Using stored Registry Credentials to push Docker apps | ||
owner: CAPI | ||
--- | ||
|
||
Registry Credentials provide a way to share Docker registry credentials across a foundation, organization, or space. Without using Registry Credentials, credentials must be provided for every push when trying to push with an image from a private registry: | ||
|
||
``` | ||
CF_DOCKER_PASSWORD=PASSWORD cf push APP-NAME --docker-image REPO/IMAGE:TAG --docker-username USER | ||
``` | ||
|
||
By creating Registry Credentials, Admins, Org Managers, and Space Developers can save Docker credentials for reuse among developers. | ||
|
||
Registry Credentials can be created at four different levels: | ||
|
||
* Foundation | ||
* Organization | ||
* Space | ||
* App | ||
|
||
For example, an Org Manager can create a Registry Credential for an Organization, which will be available to all Apps within that Organization: | ||
|
||
``` | ||
cf target -o ORG | ||
CF_DOCKER_PASSWORD=PASSWORD cf create-org-registry-credential REGISTRY-LOCATION --username USER | ||
``` | ||
|
||
After the Registry Credential is created, Space Developers can push apps referencing images in the private registry without providing credentials: | ||
|
||
``` | ||
cf push APP-NAME --docker-image REGISTRY-LOCATION/REPO/IMAGE:TAG | ||
``` | ||
|
||
## <a id='creating'></a> Creating Registry Credentials for a Foundation, Organization, or Space | ||
|
||
Registry Credentials can be created for a Foundation, Organization, or Space using the `cf create-foundation-registry-credential`, `cf create-org-registry-credential`, or `cf create-space-registry-credential` commands. | ||
|
||
For example, an Admin can create a Registry Credential for the Foundation: | ||
|
||
``` | ||
cf create-foundation-registry-credential REGISTRY-LOCATION --username USER | ||
``` | ||
|
||
The password for the Registry Credential can be provided using the `CF_DOCKER_PASSWORD` environment variable. If the environment variable is not set, users are prompted for the password. | ||
|
||
- **Foundation-scoped Registry Credentials** are available to all Apps on the platform and can only be created or altered by an Admin. | ||
- **Organization-scoped Registry Credentials** are available to Apps within the Organization and can only be created or altered by an Org Manager or Admin. | ||
- **Space-scoped Registry Credentials** are available to all Apps within the Space and can be created or altered by a Space Developer or Admin. | ||
|
||
The `create-org-registry-credential` and `create-space-registry-credential` commands are context sensitive and create Registry Credentials for the Organization or Space that the user is currently targeting. For example, to create a Space-scoped Registry Credential, the user must target the Space first: | ||
|
||
``` | ||
cf target -o ORG -s SPACE | ||
cf create-space-registry-credential REGISTRY-LOCATION --username USER | ||
``` | ||
|
||
`REGISTRY-LOCATION` must include a host name, and may include paths and/or ports; for example, `registry.example.com`, `registry.example.com/path`, `registry.example.com/path/to/repo:5000`. Protocols such as `https://` must not be included. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to have a space example to complete the set. |
||
## <a id='app-registry-credential'></a> Creating Registry Credentials for an app | ||
|
||
If an App is pushed with Docker credentials provided, an App-scoped Registry Credential is created automatically for the App, allowing future pushes to omit credentials. | ||
|
||
This Registry Credential is only available to the App and cannot be shared with other Apps; it takes precedence over any other Registry Credential for that particular private registry. | ||
|
||
Providing new credentials on future pushes updates the App-scoped Registry Credential. | ||
|
||
App-scoped Registry Credentials are only created or updated during the 'start' phase of the push. If a push fails during staging (potentially due to incorrect credentials), for example, the App-scoped Registry Credential is not created. | ||
|
||
## <a id='using'></a> Using Registry Credentials | ||
|
||
When pushing an app, the Registry Credential is selected by the following order of precedence: | ||
|
||
1. App-scoped Registry Credential | ||
1. Space-scoped Registry Credential | ||
1. Organization-scoped Registry Credential | ||
1. Foundation-scoped Registry Credential | ||
|
||
Among each level, the Registry Location is extracted from the image reference and used to find a possible matching Registry Credentials. More specific matches are preferred. | ||
|
||
For example, if an App is pushed with the image reference `registry.example.com/repo/image:tag`, App-scoped Registry Credentials are searched for in the following order: | ||
|
||
1. `registry.example.com/repo` | ||
1. `registry.example.com` | ||
1. `example.com` | ||
|
||
If no App-scoped Registry Credential is found, the same search is performed for Space-scoped Registry Credentials, then Organization-scoped Registry Credentials, and finally, Foundation-scoped Registry Credentials. | ||
|
||
If no matching Registry Credential is found, the app push continues as normal, in case the image is publically accessible. | ||
|
||
Images references of the form `REPO/IMAGE:TAG` (i.e. with no registry host name) search for Registry Credentials for `docker.io/libary` or `docker.io`. | ||
|
||
## <a id='deleting'></a> Deleting Registry Credentials | ||
|
||
Registry Credentials can be deleted using the appropriate command: | ||
|
||
``` | ||
cf delete-foundation-registry-credential REGISTRY-LOCATION | ||
cf delete-org-registry-credential REGISTRY-LOCATION | ||
cf delete-space-registry-credential REGISTRY-LOCATION | ||
cf delete-app-registry-credential REGISTRY-LOCATION APP-NAME | ||
``` | ||
|
||
Deleting a Registry Credential causes any apps that were pushed with that Registry Credential to fail to stage and start in the future, unless other Registry Credentials are made available to them. | ||
|
||
## <a id='updating'></a> Updating Registry Credentials | ||
|
||
Registry Credentials can be updated using the appropriate command: | ||
|
||
``` | ||
cf update-foundation-registry-credential REGISTRY-LOCATION --username USER | ||
cf update-org-registry-credential REGISTRY-LOCATION --username USER | ||
cf update-space-registry-credential REGISTRY-LOCATION --username USER | ||
``` | ||
|
||
App-scoped Registry Credentials can be updated by pushing the app with new credentials: | ||
|
||
``` | ||
cf push APP-NAME --docker-image REGISTRY-LOCATION/REPO/IMAGE:TAG --docker-username USER | ||
``` | ||
|
||
Like the creation commands, the password for the Registry Credential can be provided using the `CF_DOCKER_PASSWORD` environment variable. If the environment variable is not set, users are prompted for the password. | ||
|
||
Only username or password may be updated; the registry location cannot be changed. | ||
|
||
## <a id='listing'></a> Listing Registry Credentials | ||
|
||
All Registry Credentials available to the currently targeted Organization and Space can be listed with the `cf registry-credentials` command: | ||
|
||
``` | ||
$ cf registry-credentials | ||
Showing registry credentials available to org 'myorg' and space 'myspace'... | ||
location scope username app name | ||
docker.io/library app myuser myapp | ||
registry.example.com space spaceuser | ||
registry.example.com/repo organization orguser | ||
docker.io/libary foundation docker-user | ||
registry.example.com/repo foundation private-repo-user | ||
``` | ||
|
||
If no space or organization is targeted, only Registry Credentials available to the foundation are listed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.