Search code examples
containersibm-cloudcloud-foundry

cf-cli keeps asking me to login even if I've done so


I'm trying to copy an image from Dockerhub to Bluemix registry by following the doc at https://new-console.eu-gb.bluemix.net/docs/containers/container_images_copying.html

I installed cf-cli and the IBM-Containers plugins on my Mac (OSX 10.11.6):

$ cf --version
cf version 6.21.0+dff2cf8-2016-07-27
$ cf plugins
Listing Installed Plugins...
OK

Plugin Name      Version   Command Name   Command Help
IBM-Containers   0.8.897   ic             IBM Containers plug-in

I've logged into my account:

$ cf login -a api.eu-gb.bluemix.net
API endpoint: api.eu-gb.bluemix.net

Email> [email protected]

Password> 
Authenticating...
OK

Targeted org Haxe Foundation

Targeted space dev



API endpoint:   https://api.eu-gb.bluemix.net (API version: 2.54.0)
User:           [email protected]
Org:            Haxe Foundation
Space:          dev

$ cf ic login -a api.eu-gb.bluemix.net
$ cf ic info
Date/Time                : 2016-08-22 08:43:39.352117576 +0800 HKT
Debug Mode               : false
Host/URL                 : https://containers-api.eu-gb.bluemix.net
Registry Host            : registry.eu-gb.bluemix.net
Bluemix API Host/URL     : https://api.eu-gb.bluemix.net
Bluemix Org              : Haxe Foundation(4a6547eb-37ae-4f41-9e7e-dcba87c99147)
Bluemix Space            : dev(45d9dba9-068b-4918-82ff-1c2210a03dbc)
CLI Version              : 0.8.897

However, when I try to copy an image, or to list the existing images, there is an error:

$ cf ic cpi gitlab/gitlab-ce:8.10.7-ce.0 registry.eu-gb.bluemix.net/gitlab-ce:8.10.7-ce.0
FAILED
The IBM Containers CLI must be initialized. Run "cf ic init" to initialize it.


$ cf ic images
FAILED
The IBM Containers CLI must be initialized. Run "cf ic init" to initialize it.

Any idea?


Solution

  • Oh, turn out I have to create a container registry namespace first. It can be done by trying to create a container in the web console. Select an existing image, say ibmliberty, and it will ask for creating a namespace for the current organisation.

    After the namespace is created, run cf ic init, then the other commands will succeed as expected.