How to deploy docker container to Cloud Foundry? - docker

My application is comprised of two separate docker containers. One being a Grails based web application and second being a RESTful Python Flask application. Both docker containers are sitting on my local computer. They are not hosted on docker hub. They are proprietary and I don't want to host them publicly.
I would like to try Cloud Foundry to deploy these docker containers and see how it works. However, from the documentation I get a sense that Cloud Foundry doesn't support deploying docker containers sitting on a local machine.
Question
Is there a way to deploy docker containers sitting on a local computer to CloudFoundry? If not, what is a way to securely host the containers somewhere from CF can fetch them?
Is CloudFoundry capable of running a docker container that is a Python Flask application?

One option you have is to not use Docker images, and just push your code directly, one of the nice features of CF. PCF comes with a python buildpack which should automatically detect your Flask app.
Another option would be run your own trusted docker registry, push your images there, and then when you push your app, tell it to grab the images from your registry. If you google "cloud foundry docker registry" you get the following useful results you should check out:
https://github.com/cloudfoundry-community/docker-registry-boshrelease
http://docs.pivotal.io/pivotalcf/1-8/adminguide/docker.html#caveats
https://docs.pivotal.io/pivotalcf/1-7/opsguide/docker-registry.html

Related

Deploy a Microservices self-hosted app to Dockerhub

I have a Full stack Microservices app with this file structure.
---app name
------web-ui
------service1
------service2
------service3
the services are java based and it uses two databases (Sqlite and MongoDB) and other services including Apashe Kafka, Elastic Search and Eureka.
and i wanted this app to be used as a self-hosted app kind of like Nextcloud or Jellyfin where anyone can just go to Dockerhub and pull the whole thing and use docker run and use it as a single image.
but how can i go about dockerizing the whole thing and deploying it to Dockerhub
I'm new to docker and the whole ecosystem so i've been doing some digging around but i got confused.
for example can i deploy it to docker hub using docker compose?

Deploying Container on GCP

I am trying to deploy this app. https://github.com/taigaio/taiga-docker . This container is a collection of various images. It uses docker-compose to create the container. It is my understanding that this cannot be run as an image from a GCP Artifact Repo as a docker Image. This needs a VM perhaps?
My question is if there is a way to deploy this container as an Image in a serverless fashion in GCP or any other cloud platform. Any pointers/help is much appreciated.
You can either use Cloud Run (the most Serverless way) or on a VM.
On Cloud Run you can deploy a single image as a Service (Cloud Run Terminology), if you have more than one image you can deploy multiple Services and make them talk to each other
Or on VM, that would be as if you are deploying on your personal laptop

GitHub Actions Runner Container on Google Cloud Run that can build docker image

I have built a docker image that when run, it registers itself as a GitHub Runner. This runner will, amongst other things, be used to build and push images to GitHub Container Registry. I don't want to deploy the containers to GKE or Compute, as I don't want the overhead of managing those resources. I would prefer to deploy the containers to Google Cloud Run. I've scoured the docs for help but I can't seem to find the answers to the following question:
Can I run 'docker in docker' when the container is deployed to GCP Cloud Run?
How do I specify the volume mount required when deploying the container to Google Cloud Run, i.e. the usual mapping with docker run would be:
-v /var/run/docker.sock:/var/run/docker.sock
I never tested but it's possible that the current Cloud Run sandbox prevent this king of use. And I don't really know the use case for this!
You can't mount volume in Cloud Run, it's stateless. You only have a in-memory file system in the /tmp directory (and it's in memory, size correctly your Cloud Run instance memory to take this into account). You can connect your instance to 3rd party product, such as Google Cloud Storage or databases, but no volume mountable on Cloud Run (for now)
If you have these requirement you can maybe have a look to autopilot and deploy directly your container on fully managed K8S.

Is it possible to deploy two different docker images within the same Cloud Run service

I've built an app that uses two home made micro services, each of the micro service having its own Dockerfile.
When I build it locally I use docker-compose for practical reasons.
Currently, when I deploy to Cloud Run I use commands like
docker tag xxx
docker push xxx
Then I select the image I want to deploy on Cloud run
As I understand, docker-compose build just builds two images (one for each Dockerfile) and the places them within the same network which allows some practical connections between these two API.
Is it possible to do something similar one Cloud Run without having to deploy each image on a different service ?
PS: For business reasons I can't host my code directly on Cloud Source Repositories, it has to be on Azure
It is not possible to deploy 2 different Docker images to Cloud Run.
The Cloud Run works in the following way:
You build a container image and upload to Google Container Registry
Deploy to Cloud Run with the container image.
Your service is automatically scaled up and down to a specific number of container instances depending on your incoming requests. Each container will run the container image.
Summary = Cloud Run takes a user's container and executes it on Google infrastructure, and handles the instantiation of instances (scaling) of that container.
Please Note, Cloud Run is designed to run Websites,REST APIs backend, Back‐office administration etc and it does not support microservices architecture (different servers running in a different container).
For you scenario, you can deploy multiple services in Cloud Run or use other Google Products such as Cloud SQL, Datastore, Spanner or BigTable.
Note: You can'd deploy 2 containers in the same service however you can deploy a container that contains multiple processes as explained in this article written by a Googler

How to deploy several docker images to single virtual machine

I have an application which consists of 2 docker containers. Both are small and need to interact with each other quite often through rest api.
How can I deploy both of them to a single Virtial Machine in Google Cloud?
Usually, when creating virtual machine, I get to chose a container image to deploy: Deploy a container image to this VM instance.
I can specify one of my images and get it running in the VM. Can I set multiple images?
You can not deploy multiple containers per VM.
Please consider this limitation when deploying containers on VMs:
1.You can only deploy one container for each VM instance. Consider Google Kubernetes Engine if you need to deploy multiple containers per
VM instance.
2.You can only deploy containers from a public repository or from a private repository at Container Registry. Other private repositories
are currently not supported.
3.You can't map a VM instance's ports to the container's ports (Docker's -p option).
4.You can only use Container-Optimized OS images with this deployment method. You can only use this feature through the Google Cloud
Platform Console or the gcloud command-line tool, not the API.
You can use docker-compose to deploy multi-container applications.
To achieve this on Google Cloud, you'll need:
ssh access to VM
docker and docker compose installed on the VM

Resources