How To : Push Docker Image to SAP Cloud Platform Cloud Foundry Landscape
It’s a very common need to use “user provided services” in the Cloud Foundry environment because the provided out of the box services that can be instantiated are not enough. I have tried to find how to create some other user provided service in an easy way. (the hard way is self-conding)
So the basic need of a virtual machine or a docker container with some pre-installed standard image of some tool emerges. That’s why I’ve tried to find this kind of info on the internet. It’s an easy task and possible only
This leverages the possibility to get any docker image that’s compatible with the Cloud Foundry landscape (memory, storage quota, opened ports) from the docker hub.
This is possible on the SAP Cloud Platform – Cloud Foundry environment – trial landscape because “Diego” is enabled by default.
I’ve needed this scenario when I’ve tried to used deploy the Docker version of Kafka and to get it started : this one
Also this kind of scenario may apply when you need services that have already a proper docker image but they are not offered as standard services from the Cloud Foundry instance you are working with.
How To (the Easy Way)
Set CF api url
cf api <api_url>
For SAP Cloud Platform (SCP) regions & hosts list is here
Getting Started Documentation is here
Login to CF
See CF flags and if Docker is enabled (by default : yes)
cf feature-flags | grep diego
Push Docker Image as a new app
cf push <app_name> --docker-image <image_name>:<tag> example: cf push nginx --docker-image nginx:latest
To access the app see the url in the push log
See app logs
cf logs <app_name> --recent
Delete an app
cf delete <app_name>
It’s easy to deploy a docker image on the SAP Cloud Platform – Cloud Foundry Landscape (trial or prod)
Be sure to use trusted docker image containers.
You can build your own docker container image and publish it in the hub. (more help here)
It may be possible to deploy from private docker registries but it implies some security settings which I haven’t tested yet.
Link to a blog post with another detailed good example with a user custom docker container