Get your copy of the O’Reilly Cassandra eBook: The Definitive Guide - Download FREE Today
Running a Cassandra Application in Docker
Docker is the dominant container runtime used in enterprises today. In this module we will look at how to deploy a cloud-native application in Docker containers. While Docker is powerful, managing individual containers can be difficult at scale.
Kubernetes simplifies deployment, management and scalability of containers. Kubernetes is the leading container orchestration technology used in enterprises today. Understanding containers is a prerequisite to learning Kubernetes. In this module we will learn how to use Docker containers to deploy an application consisting of an Apache Cassandra™ cluster, a Spring Boot service and an Angular web application with an nginx server.
Docker images combine an application and the environment necessary for it to run. Dockerfiles define how images are built. Images run in containers and containers communicate using Docker networks.Next: Docker Images
Docker images are read only files that combine an application and the environment necessary for it to run. The environment includes the libraries, dependencies, tools, and files. Images are the templates from which Docker containers are instantiated. Images are typically stored in public or private repositories so they can be used to consistently create and recreate Docker containers. Use the build command from the Docker command line interface (CLI) to build an image from a Dockerfile.Next: Dockerfiles
A Dockerfile is a text file that defines all of the steps necessary to create a docker image.
Most Dockerfiles begin by referencing a parent image. Typical parent images define core tools like nginx, openjdk or nodeJS. Using layering you can define a Dockerfile with a parent image that has another parent image.
A Dockerfile may define the commands necessary to build an application, and the environment variables it needs to run. It may also download and install software and run the scripts necessary to build it.
A Docker container is a virtual environment for running an application (packaged as Docker image) while isolating it from the host environment. Containers use operating system services directly from the host environment. Since they don’t contain a complete OS, containers are smaller than virtual machines and boot up very quickly.
Containers may make network endpoints available in the host network.
In a cloud-native application, components deployed in containers can be quickly instantiated or shut down to support elasticity.
Applications running in Docker containers need to communicate with other applications. These other applications may be running in Docker containers or directly on a host OS. Docker networking creates an OS-agnostic network framework for containers.
Docker networks allow containers to communicate with one another while remaining isolated from the host network.