March 2, 2020 By Takeyuki Nakajo 5 min read

By following three easy steps, you’ll learn how to migrate your Cloud Foundry applications to Docker containers on IBM Cloud Kubernetes Service.

The IBM Cloud Kubernetes Service delivers powerful tools by combining Docker containers, the Kubernetes technology, an intuitive user experience, and built-in security and isolation to automate the deployment, operation, scaling, and monitoring of containerized apps in a cluster of compute hosts. 

If you have any Cloud Foundry applications, you can migrate them to Docker containers on the IBM Cloud Kubernetes Service. There are many ways to do this, but I’m going to show you the simplest way by using the IBM Cloud Continuous Delivery service.



  1. Prepare the source code for a Cloud Foundry application.
  2. Create a new toolchain for deploying a Kubernetes app.
  3. Configure the Delivery Pipeline for deploying a Kubernetes app.

1. Prepare the source code for a Cloud Foundry application

This is the sample Cloud Foundry application running on the IBM public cloud. For this tutorial, you can use the the Node.js Hello World sample source code.

When you have your source code, it should look like this:

  • GitHub repository URL:
  • GitLab repository URL:

2. Create a new toolchain for deploying a Kubernetes app

The IBM Cloud Continuous Delivery service includes open toolchains that automate the building and deployment of applications. You will need to create a new toolchain to deploy a Kubernetes app with the source code.

  1. From the IBM Cloud console, click the Menu icon and select DevOps.
  2. On the DevOps dashboard, on the Toolchains page, click Create a Toolchain.
  3. On the Create a Toolchain page, click the toolchain template Develop a Kubernetes app.
  4. On the Develop a Kubernetes app page, type in the Toolchain Name.
  5. In the Tool Integrations section, select the Repository type (Clone), enter the Source repository URL (, and type a new Repository Name. This indicates the source repository is cloned into your source repository. If you want, you can type the source repository URL for your Cloud Foundry app.
  6. In the Tool Integrations section, click Delivery Pipeline, put in the App name, and type the existing IBM Cloud API key or click the New button to create a new key. 
  7. Enter the Container registry region and Container registry namespace where the Docker image is stored.
  8. Select the Cluster region, Resource Group, Cluster name, and Cluster namespace where the app is deployed.
  9. Confirm your updates by clicking Create

Several steps will run automatically to set up your toolchain.

  • The toolchain is created.
  • The source repository is cloned into your source repository.
  • The delivery pipelines are created and triggered.

3. Configure the delivery pipeline for deploying a Kubernetes app

  1. Once the toolchain is created, your toolchain Overview is displayed. Click the Delivery Pipeline panel to access the delivery pipeline stages (BUILD, CONTAINERIZE, and DEPLOY). Let’s see if a Kubernetes app deployed.
  2. Wait a sec! You see that the Check dockerfile job failed in the CONTAINERIZE stage. Click the job to see the log.
  3. This is because a file named Dockerfile was not found in the source repository. Dockerfile is the instruction to build a Docker image automatically, and you just need to add a Dockerfile by following the instructions here.
  4. Go back to the Toolchain page and click the Git panel to access your source code in the repository. 
  5. Add a new file named Dockerfile, copy the following code, and paste it into the file. Then click Commit.
    FROM node:alpine
    RUN apk update && apk upgrade
    # Install the application
    ADD package.json /app/package.json
    RUN cd /app && npm install
    COPY app.js /app/app.js
    RUN mkdir /app/public
    COPY /public/ /app/public/
    WORKDIR /app
    ENV PORT 8080
    EXPOSE 8080
    # Define command to run the application when the container starts
    CMD ["node", "app.js"]
  6. Go back to the Toolchain page, click the Delivery Pipeline panel to access the delivery pipeline stages.
  7. Because you committed the change in the source repository, it triggered to run the Delivery Pipeline. After about 10 minutes, you will see that all pipeline stages (BUILD, CONTAINERIZE, and DEPLOY) passed. Click the Deploy to Kubernetes job in the DEPLOY stage to see the Stage History.
  8. As you can see from the Stage History for the Deploy to Kubernetes Job in the DEPLOY stage, the initial deployment.yaml is automatically created because there is no deployment.yaml in the source repository. You can create a deployment.yaml file in the source repository to define how you deploy apps to containers on the Kubernetes cluster and add it in the repository for your requirement. See more details here.
  9. You will see the message Finished: SUCCESS in the DEPLOY stage. Click the VIEW THE APPLICATION AT: The app is exposed with a NodePort service in the format http://<IP_address>:<nodeport>.
  10. The application is successfully deployed as a Kubernetes app. You’re now able to access the application running on the Kubernetes service.


By following these steps, you’re now able to migrate Cloud Foundry applications to Docker containers on IBM Cloud Kubernetes Service. In doing so, you expose the app with a NodePort service in the format http://<IP_address>:<nodeport>

If you use a standard cluster, you can create the ingress resource to route traffic to your app service so that you can expose apps with the IBM-provided domain or a custom domain—also HTTPS and TLS/SSL authentication in the format https://<>. Learn more about the ingress resource.

Was this article helpful?

More from Cloud

Enhance your data security posture with a no-code approach to application-level encryption

4 min read - Data is the lifeblood of every organization. As your organization’s data footprint expands across the clouds and between your own business lines to drive value, it is essential to secure data at all stages of the cloud adoption and throughout the data lifecycle. While there are different mechanisms available to encrypt data throughout its lifecycle (in transit, at rest and in use), application-level encryption (ALE) provides an additional layer of protection by encrypting data at its source. ALE can enhance…

Attention new clients: exciting financial incentives for VMware Cloud Foundation on IBM Cloud

4 min read - New client specials: Get up to 50% off when you commit to a 1- or 3-year term contract on new VCF-as-a-Service offerings, plus an additional value of up to USD 200K in credits through 30 June 2025 when you migrate your VMware workloads to IBM Cloud®.1 Low starting prices: On-demand VCF-as-a-Service deployments begin under USD 200 per month.2 The IBM Cloud benefit: See the potential for a 201%3 return on investment (ROI) over 3 years with reduced downtime, cost and…

The history of the central processing unit (CPU)

10 min read - The central processing unit (CPU) is the computer’s brain. It handles the assignment and processing of tasks, in addition to functions that make a computer run. There’s no way to overstate the importance of the CPU to computing. Virtually all computer systems contain, at the least, some type of basic CPU. Regardless of whether they’re used in personal computers (PCs), laptops, tablets, smartphones or even in supercomputers whose output is so strong it must be measured in floating-point operations per…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters