IBM Container Registry
Support for the latest IBM Cloud container registries was changed in version 20 of the Docker Registry plug-in to remove dependencies on the IBM Cloud (Bluemix) Cloud Foundry plug-in and the depreciated Bluemix IBM Containers plug-in (bx ic). Support for OAuth protected IBM Cloud container registries was also introduced in version 20.
The IBM Cloud (Bluemix) command line interface, the IBM Cloud container registry plug-in, and IBM Cloud container service plug-in are required to be installed on your UrbanCode Deploy agent machine to access IBM Cloud container registries. Docker itself must also be installed on the agent machine.
The following properties are used when connecting to an IBM Cloud container registry.
- Image Name: The name of the image in the format [namespace/][repository].
- Registry: The name of registry to connect to (for example, registry.ng.bluemix.net).
- Registry Type: Select the
- IBM Cloud API Endpoint: The IBM Cloud API endpoint to use (for example, api.ng.bluemix.net)
- IBM Cloud Space: The space to use when connected to IBM Cloud.
- IBM Cloud Organization: The organization to use when connected to IBM Cloud.
- Bluemix Home: Specify the location of your Bluemix config.json file
- Registry Username: The username to use when connecting to IBM Cloud. Specified if not using an API key to connect.
- Registry Password: The password to use when connecting to IBM Cloud. Specified if not using an API key to connect.
- Registry API Key: The API key to use when connecting to IBM Cloud. Specified if not using a username/password to connect.
Image and Registry Properties
bx cr images command will return something like this:
In the example above, the REPOSITORY column shows a name made of three pieces. Take
registry.ng.bluemix.net/mynamespace2/bgdemohello as an example. The text
registry.ng.bluemix.net refers to the container registry. The text
mynamespace2 refers to a namespace which is used for personal or private images for a specific organization or user. The text
bgdemohello refers to the image name itself.
Following our example, in UrbanCode Deploy, the Image Name field would contain the value
mynamespace2/bgdemohello and the Registry filed would contain
The Registry Type field should be set to IBM Containers, as that instructs the plug-in to connect to an IBM Cloud container registry.
IBM Cloud Properties
There are several properties used when connecting to IBM Cloud (Bluemix). The IBM Cloud API Endpoint, IBM Cloud Space, and IBM Cloud Organization field may be set to values used when connecting to IBM Cloud. For authentication, the Registry Username and Registry Password fields may be filled out, or users may specify an API key using the Registry API Key field.
The location of your Bluemix config.json file is needed to pull image tags from the IBM Cloud container registry. After connecting to Bluemix, an IAMRefreshToken is placed in the Bluemix config.json file. This token is required when the Docker registry UrbanCode Deploy plug-in makes a REST call to pull image tags from the container registry.
Below is the general approach the Docker Registry plug-in takes when connecting to an IBM Cloud container registry:
- Run a command line command to connect to IBM Cloud (Bluemix)
- Run a command line command to log into the container registry
- Make a REST call to the container registry to pull image tags using a token found in the Bluemix config.json file
- If the REST call returns 401-Unauthroized, OAuth may be enabled. Request an OAuth token via a REST call, then make a REST call to pull images using the OAuth token.