This article is about Codeship Pro.

Deploying To IBM Bluemix Container Service

You'll need roughly 4 minutes to read this article.

You can find a sample repo for deploying to IBM Bluemix with Codeship Pro on Github here.

Continuous Delivery To IBM Bluemix Container Service

To make it easy for you to deploy your application to IBM Bluemix Container Service, we’ve built deployment images that have the Bluemix CLI installed and configured for use in the CI/CD process.

You will simply need to add one of the IBM deployment images as a service in your codeship-services.yml file so that you can run the commands you need.

IBM Bluemix Deployment Container


Prior to getting started, please ensure you have the following:


To deploy to IBM, you will need to add the following values to your encrypted environment variables that you encrypt and include in your codeship-services.yml file:


These variables will be set on the IBM deployment container, which you can read more about below. This deployment container will use the environment variables as part of the authentication required by the IBM Bluemix CLI when you run your deployment commands.

Configuring Deployment Service

Once you have created your encrypted environment variables, you will want to add a new service to your codeship-services.yml file.

This file will use the image Codeship maintains for IBM-based deployments, and will read your code from a volume connected to your primary service.

This service will be used for all of your Container Service deployment commands, and will use the encrypted environment variables you created above.

    image: your-org/your-app
    path: .
  encrypted_env_file: ibm.env.encrypted
    - ./deployment/tests:/tests

  image: codeship/ibm-bluemix-dockercfg-generator
  add_docker: true
  encrypted_env_file: bluemix.env.encrypted

  image: codeship/ibm-bluemix-deployment
  encrypted_env_file: ibm.env.encrypted
    - ./deployment/tests:/tests

Container Registry

Using IBM Bluemix Container Service usually involves pushing images to the IBM Bluemix Container Registry as part of your CI/CD process.

We recommend reading our guide for pushing to the Bluemix registry, as the deployment commands below will feature an image push based on those instructions.

Deploying Your App

Once you have added the deployment service to your codeship-services.yml file, you will now run Container Service deployment commands from your codeship-steps.yml file using that service to execute the commands.

Note that in this example, all of the Container Service deployment commands have been moved to a script file named The reason it is named is because the IBM Bluemix Container Service uses Kubernetes to orchestrate container deployments, so you will use Kubernetes commands in your deployment commands.

- name: Push To Bluemix Container Registry
  service: app
  type: push
  dockercfg_service: dockercfg_generator  

- name: Bluemix Container Service Kubernetes Deployment
  service: deployment
  command: /tests/

Inside the script, you will have something similar to:


set -e

# login to IBM Bluemix via credentials provided via (encrypted) environment
# variables
bluemix login \
  --apikey "${BLUEMIX_API_KEY}" \

bluemix cs init \

# Get the required configuration for `kubectl` from Bluemix and load it
bluemix cs cluster-config \
  > .kubectl_config
source .kubectl_config && rm -rf .kubectl_config

# run the commands required to deploy the application via `kubectl`
kubectl version
kubectl cluster-info

See Also

To learn more: