Exploring Docker Concepts: Volumes, Consumption, and Swarm Explained
Docker Volume
- Used to maintain the persistent data
Types of Applications on Container Perspective :
Stateless Applications
Stateful Applications
docker volume create <volume_name>
Create a Docker Volume in Host Machine
docker volume list
To get the list of volumes
docker volume inspect <volume_name>
Get the properties of created volume
docker run -it --mount <source=volume>name>,<destination=destination_location> <container_image> bash
To mount the volume to the required location
Container Orchestration
Overview of Docker Compose
Is used to run the multiple containers as a service
Docker compose is the default package of container engine
Docker compose is an extension/plugins to docker
Steps to run multiple container as a service
First install the docker compose
//https://docs.docker.com/compose/install/linux/
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
docker compose version
Create a manifest/config file ==> Is written using yaml script.
vi docker-compose.yaml
version: '3' services: webserv: image: "tomcat:8.0" ports: - 8098:8080 dbserv: image: "redis:alpine"
docker compose up - Start all the container as defined in docker-compose file
docker compose down - Stop all the container as defined in docker-compose file
Docker Swarm
Docker swarm is one of the Container orchestration tool
It is meant only for docker containers
Used to ensure high availability of the containers by creating Replicas of containers
We cannot to Auto scaling and load balancing