Skip to Content
Technical Articles
Author's profile photo Swapnil Galgali

Deploying Docker Application on SAP Cloud Platform Cloud Foundry using AWS ECR and Google Cloud Platform Container Registry

This blog post focuses on the deployment of an application using Docker Container on SAP Cloud Platform Cloud Foundry (CF).

Cloud Foundry supports deployment of docker container from below container registry:

  1. Docker Hub
  2. Amazon Web Services Elastic Container Registry (AWS ECR)
  3. Google Container Registry (GCR)

Concepts of Containerization, Virtualization, and Life cycle of Docker containers can be found here.

SAP Cloud Platform Cloud Foundry is a Multi-Cloud Business Technology Platform that supports Docker Containers, Kubernetes for virtualization, and containerization.

There are many blogs explaining deployment from Docker Hub to SAP Cloud Platform Cloud Foundry, but I could not find any blog or documentation for AWS and GCP. So, I decided to write this blog by consolidating steps to deploy the docker image from AWS and GCP.

This blog is an attempt to provide simple, systematic but detailed steps to deploy docker containers from AWS and GCP to SAP Cloud Foundry.

What will we do?

  • Build Docker Image
  • Test Docker Image Locally
  • Push Docker Image to AWS ECR
  • Push Docker Image to Google Cloud Platform Container Registry
  • Deploy Docker Image to SAP Cloud Platform Cloud Foundry from AWS
  • Deploy Docker Image to SAP Cloud Platform Cloud Foundry from Google Cloud Platform Container Registry

Assumptions and Pre-requisites:

So, before starting I am assuming a few things, you can take them as initial requirements.

  • Docker Desktop is Installed
  • SAP CF CLI installed
  • You have App ready for deployment
  • You have AWS account
  • You have GCP account
  • You have AWS CLI installed
  • You have Google cloud SDK installed


Help Links:

Docker Desktop
Google Cloud SDK
SAP Cloud Foundry CLI



Step 1: Build a docker image

We will use sample code available at

Demo code is available on Git Link:

Clone the project from git as below


Let us build the docker image as below


Step 2: Run and Test Docker Image Locally

Let us run the docker image locally and check if it is working correctly.

Check http://localhost:80 in the browser





Step 3: Push Docker to AWS ECR

Go to AWS Account Console > Amazon Container Registry

Step 4: Create a new repository to push the docker image



Now it is time to push local docker image to AWS ECR repository that we have created.

For that we need to install AWS CLI and log in with AWS account ID.


You can get AWS access key id and secret access key at IAM in AWS Console.

You can create the new key as well. It is better to download the secret access key as it is not visible in the console after it is generated and displayed only once.


Let us list available docker images using CLI

Step 6:  Push Docker Image to AWS ECR

To tag local Docker image to AWS ECR

  1. aws ecr get-login-password –region region | docker login –username AWS –password-stdin
  2. docker tag <dockerimage name with tag> <aws_account_id> ecr repository name with tag
  3. docker push aws ecr repository name with tag

Push docker image to AWS ECR repository as below:

You can check the pushed docker in AWS ECR in AWS Console.

Step 7: Let us deploy this image to SAP Cloud Platform Cloud Foundry environment and run it as below using CLI

  1. Log in to Cloud Foundry account
  2. Select Subaccount and Space
  3. Deploy Docker image as Cloud Foundry App


Command to deploy docker image as CF APP


cf push APP-NAME –docker-image <REPO/IMAGE:TAG> –docker-username <AWS-ACCESS-KEY-ID>


You can get the docker image repo full path from AWS ECR Console






Step 8: Copy the route from the deployed app and open it in the browser.

You should be able to view below the page.





Step 8: Push Docker to Google Cloud Platform Container Registry :

Create Google Cloud Platform Account.

Enable billing.

Install the latest version of CloudSDK CLI which includes gcloud CLI.

Log in to cloud sdk as below with the following command.

gcloud init 

It fetches the default service account and you can set the project id on which we will be pushing the docker image.

It asks you to authorize cloud SDK access to google cloud account.


Step 9: We need to create a service account in order to push docker images to Google Container Registry and Deploy it on SAP Cloud Platform

Step 10: Assign below 2 roles to the created account.

While pushing Docker images to Google Container Registry, it uses Cloud Storage service hence we need to provide StorageAdmin access to the account.

The email contains the full path of service account which will be used to authenticate Google Container Registry services.

Step 11: Now tag the docker image to Google Container Registry repository and push the docker image as below:



Now let us create the key for the service account that we have created as below


 Step 12: Now we will use the access token to get access to Google Container Registry

Using which we deploy this docker image to SAP Cloud Platform


gcloud auth printaccesstokendocker login u oauth2accesstoken p “ya29.8QEQIfY_…” https://[HOSTNAME]

Once we are able to login successfully with the oauth2 token, we should be able to deploy a docker image from Google Container Registry to SAP Cloud Platform as below:

Step 13: Kindly confirm if the image is running correctly or not by pasting the route in the browser.







Step: 14 You can also confirm by checking SAP Cloud Platform Cloud Foundry cockpit Space under applications



Once we follow all the steps mentioned above, we will be able to deploy docker containers from AWS as well as GCP on SAP Cloud Platform Cloud Foundry.

I hope this blog post will help you to deploy docker images on SAP Cloud Platform Cloud Foundry.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Nicholas Nicoloudis
      Nicholas Nicoloudis

      Hi Swapnil,


      Great blog, by using this approach customers will be able to containerise their applications and deploy to the hyperscaler of their choice.  This is key since different hyperscalers do offer different  different services at different cost models.





      Author's profile photo Swapnil Galgali
      Swapnil Galgali
      Blog Post Author

      Thank You Dr. Nic.

      Author's profile photo Werner Dähn
      Werner Dähn

      There is one point I would need help: What are the benefits of running the docker image in SCP instead of in AWS ECR directly?

      Okay, SCP's "CF" command to deploy the image is the same in Google and Amazon instead of two different CLI commands but that is little to no advantage. And if you use kubectl (Kubernetes) in both, it is the same again.

      All important SCP services, e.g. Hana DWH Cloud, Hana DBaaS can be connected to from outside, so that's no argument either.

      Am I missing something?

      Author's profile photo Swapnil Galgali
      Swapnil Galgali
      Blog Post Author

      Hi Werner,

      AWS ECR is a service that provides a repository to maintain docker images.
      AWS ECS, AWS Fargate, AWS Batch, and AWS EKS are the services that allow users to deploy docker images.
      Each of the services has separate pricing associated with it.

      When a docker image is deployed on SAP Cloud Platform CF, it is just another Cloud Foundry Application. So it consumes the Application Runtime resources from the underlying SAP Cloud Platform service plan(CPEA/Subscription). No additional cost is required specifically for the docker container.

      This blog post is to showcase the capability of SAP Cloud Platform Cloud Environment of hosting docker containers. Any docker image needs to be maintained in the Container registry to deploy it on the Cloud Platform. Examples of container registries are mentioned in the above blog post.
      Hence docker images are first pushed on to AWS ECR and GCP CR respectively.

      CF commands are not SCP specific. It is the Cloud Foundry specification.
      You can find all the commands at below link:

      All these commands support the cloud platform which follows Cloud Foundry Specifications like Pivot, SAP Cloud Platform, BOSH to name a few.

      Even though CF commands are same for AWS and GCP, authentication mechanism/methods supported by both platform differs as shown in the above blog post.