Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Cloud Foundry and Docker?

I am a Java developer. We use Weblogic to host our applications. I have been told to look into replacing weblogic with an opensource alternative. We are planning use with SpringBoot. We are also looking at Docker/Cloud Foundry. However Docker/Cloud Foundry is new territory for me.

  1. Can someone please tell me the difference between Cloud Foundry and Docker?
  2. If we use Docker but not Cloud foundry, what are we missing out on?
  3. If we use Cloud Foundry but not Docker, what are we missing out on?

Thank you for your help.

like image 276
James Avatar asked Jun 13 '15 15:06

James


People also ask

What is difference between cloud and Docker?

The major difference between both of them is that containers share their host's OS kernel and can easily share storage space.

What is the difference between PCF and Docker?

PCF is PaaS (Platform As A Service) and Docker is IaaS (Infrastructure As A Service), so the former works at a higher level of abstraction.

Is Cloud Foundry a container?

Each instance of an app deployed to Cloud Foundry runs within its own self-contained environment, a Garden container. This container isolates processes, memory, and the filesystem using operating system features and the characteristics of the virtual and physical infrastructure where Cloud Foundry is deployed.

What is the difference between Cloud Foundry and Kubernetes?

Cloud Foundry is an opinionated set of components that are designed and distributed to work together. Kubernetes is a flexible and extensible system with a wide range of open source components from which you can choose, install, configure and maintain.


1 Answers

Docker is a technology for creating and running Linux "containers." In some sense, you can think of these as lightweight VMs. A docker container for SpringBoot app will consist of a docker image, which will basically contain a filesystem with all the things needed to run your app (JVM, your source code, etc.), and docker container metadata, which tells the docker daemon how to run the app inside the image (e.g. what environment variables to set, what ports to expose, what commands to run, etc.). The docker daemon will use Linux features such as cgroups and kernel namespaces to run the container in isolation from other processes running on the host machine. Docker is somewhat low-level, in that you need to specify everything that goes into the image, and it runs arbitrary things, namely whatever you put into your image and tell it to run. The docker container that you get is very portable, so you can build, test, and run your docker container locally for development, and then ship that container to a production host that also has a docker daemon running on it, and be quite confident that you're getting the exact same thing.

Cloud Foundry works at a higher layer of abstraction, with applications being a first class concept. Cloud Foundry uses containerization technology similar to docker to build portable images and then run them, but it's an implementation detail and you don't need to specify all the details. In newer versions of Cloud Foundry, docker images will also be supported so you can specify the details if you want, but it also has a "buildpack" workflow, where it will automatically detect a Java application when you push your app and will know to include all the things necessary for the Java runtime when it builds the image.

With Cloud Foundry, since applications and application management are first class concepts, and since it operates at a higher level, you get all sorts of things for free. For instance, you can easily scale your app horizontally (add instances), e.g. cf scale my_app -i 5 or vertically, cf scale my_app -m 2G (to set the allocated memory for each instance). You get streaming application logs: cf logs my_app. Cloud Foundry gives you a lot of fault tolerance for free, so if one of your application instances crashes, or the process running the application containers itself crashes (the thing that's similar to the docker daemon), or if the host VM that's running the container-running process dies, or the hardware cluster where that VM resides dies, Cloud Foundry will automatically bring your instances back up.

The docker daemon is a single process you can run on any Linux machine. So if you're doing something small and simple, and you need to do most of the setup yourself, it can be easier to get up and running both locally and in development using docker. With docker it's also easier to have access and share the docker image you create, so once you've created an image, you can put it in a docker repository, and then you can run it on any other docker daemon. With Cloud Foundry, the built image is generally an implementation detail and you don't really have access to it, so for instance you couldn't extract that image and run it on another Cloud Foundry installation.

There are various projects out there intended to make Cloud Foundry more accessible and easier to set up, while still giving you many of the benefits of a PaaS. Some of these projects also aim to allow you to combine using docker and the benefits of docker while also getting a lot of the PaaS benefits you get from Cloud Foundry.

See Lattice and Cloud Foundry on BOSH-Lite.

There are also several hosted Cloud Foundry services.

See Pivotal Web Services and IBM BlueMix

There are also a lot of non-CF projects intended to put a platform layer around the core docker technology, in both run-your-own and hosted-service varieties.

See Google's Kubernetes project and Amazon Container Service

Full disclosure: I'm a software engineer working on Cloud Foundry at Pivotal

like image 93
Amit Kumar Gupta Avatar answered Sep 18 '22 17:09

Amit Kumar Gupta