In this short article I will describe the steps you need to implement to push a docker image from docker hub to cloud foundry
First you need to create an account in docker hub and and push your docker image to docker hub using the below command.
docker push your-docker-hub-repository:your-docker-image
Your docker image will now be available in docker hub.
For the Cloud Foundry steps, you first need to create an account with pivotal After that you can install the cloud foundry cli from their website or if you are using Linux you can use the below command to install it.
sudo apt-get install cf-cli
Now you need to set the API end point using the below command. This will ask for your credentials and you need to enter your pivotal account details.
cf api https://api.run.pivotal.io
Now you need to set the target. If you are just doing it to test their service, you can register for free trial with pivotal web services. You will have to give your phone number and you will get a verification code.
You will then be able to create a org and space in pivotal web services. Once you create a org say your-app-org, the space named development will be created by default. You can create different space for different environments like DEV, UAT and PROD etc.
Now you will be able to set the target using the command below to push your app.
cf target -o your-app-org -s development
Now push your image from docker hub to the development space using the command below.
cf push service-name-in-cf --docker-image your-docker-repository:your-docker-image
Cloud foundry will automatically start your application. To check the logs for your application, you can use the command below.
cf logs service-name-in-cf --recent
To check your apps in cloud foundry, you can use the below command
Sharing is Caring!
RECOMMENDED POSTS FOR YOU