Search code examples
dockercontainersibm-cloudwerckercontainer-registry

Deploy to IBM Containers without cf/ice CLI


I currently have a workflow that goes like this: Bitbucket -> Wercker.

Wercker correctly builds my app, but when it comes to deploying I am lost. I am attempting to deploy to my IBM Containers registry on Bluemix (recently out of beta). Running docker login registry.ng.bluemix.net with my IBM account credentials returns a 401: bad credentials on my local machine (boot2docker on OSX). It does the same on Wercker in my deploy step. Here is my deploy step:

deploy:
  box:
    id: node
    tag: 0.12.6-slim
  steps:
    - internal/docker-push:
            username: $USERNAME
            password: $PASSWORD
            tag: main
            entrypoint: node bundle/main.js
            repository: <my namespace/<my container name> (removed for this post)
            registry: registry.ng.bluemix.net

As you can see: I have the username and password passed in as environment variables as per the Wercker Docs (and I have tested that they are passed in correctly).

Basically: how do you push containers to an IBM registry WITHOUT using the ice/cf CLI? I have a feeling that I'm missing something obvious. I just can't find it.


Solution

  • Turns out: it's very possible.

    Basically:

    • Install CF cli
    • cf login -a https://api.ng.bluemix.net
    • Extract token from ~/.cf/config.json (text after bearer in AccessToken + "|" + OrganizationFields.Guid

    It depends what you want to do with it. I have a very detailed write-up here on Github. You can use the token as the password, passing 'bearer' as the username.

    @mods: Is this enough for me to link to another site? I really hate to duplicate stuff like this...