Document
Docker Compose

Docker Compose

An open-source platform called Docker makes designing, shipping, and deploying applications simple. It runs an application in an isolated environment

Related articles

Speech-to-Text:准确地将语音转换为文字- Google Cloud 2 Cara Nonton Yande Tanpa Aplikasi Tambahan dengan Mudah How to Uninstall Adobe Software Without Logging in On Cloud 5 Shoe Review The 6 R’s Of Cloud Migration Strategy

An open-source platform called Docker makes designing, shipping, and deploying applications simple. It runs an application in an isolated environment by compiling its dependencies into a so-called container. for additional information on Docker. In a normal case, several service, such as a database and load balancing, are required to support an application.

We’ll look at Docker Compose’s assistance with setting up many service in this article. Also, we will see a demonstration of installing and utilizing Docker Compose. Let’s try to understand docker-compose simply.

Docker Compose will execute a YAML-based multi-container application. TheYAML file consists of all configurations needed to deploy containers Docker Compose, which is integrated with Docker Swarm, and provides directions for building and deploying containers. With Docker Compose, each container is constructed to run on a single host.

Key Concepts in Docker Compose

Docker Compose is is is a powerful tool for manage multi – container application , and master its key component — like service , network , volume , and environment variable — can greatly enhance its usage . let ’s break down these concept and how they work within a Docker compose file .

Docker Compose File (YAML Format)

Docker Compose configurations are mainly stored in a file named docker-compose.yml, which is uses useYAML format to define an application’s environment. This file includes all the necessary details to set up and run your application, such as service, networks, and volumes. To use Docker Compose in an effective way you have to know the structure of this file .

Key Elements of the YAML configuration

  • Version: It is defines define the format of the Compose file , by ensure compatibility with specific Docker Compose feature and syntax .
  • service: Theservice section lists each containerized service required for the application. Each service can have its configuration options, such as which image to use, environment variables, and resource limits.
  • network: In network section , you is define can define custom network that enable communication between container . additionally , it is allows allow you to specify network driver and custom setting for organize container interaction .
  • volume: volume allow for data persistence across container restarts and can be shared between containers if needed. They enable you to store data outside the container’s lifecycle, making it useful for shared storage or preserving application state.

exampledocker-compose.yml

Here’s a sample Compose file that defines two service, a shared network, and a volume:

version : ' 3.8 '

service:
web:
image: nginx:latest
port :
- " 80:80 "
network :
- frontend
volume :
- shared-volume:/usr/share/nginx/html


app:
image: node:14
working_dir: /app
network :
- frontend
volume :
- shared-volume:/app/data

network :
frontend :
driver: bridge

volume :
shared-volume:

Explanation:

  • Theweb service is runs run an Nginx container , andapp runs a Node.js container.
  • Both service connect through the frontend network, allowing them to communicate.
  • Theshared-volume volume is mount in both container , provide shared storage for file .

Docker Compose service

In Docker Compose , every component is operates of your application operate as a separate service , with each service run a single container tailor to a specific role — such as a database ,web server, or cache. These service are defined within the `service` section of the `docker-compose.yml` file . This section lets you configure each service individually, specifying details like the Docker image to pull, environment variables, network connections, and storage options. Through this setup, you can control how each part of your application interacts, ensuring smooth communication and resource management across the service.

Key Service Configuration Options

  • Image: image option is defines define which Docker image we are go to use by the service from the Docker Hub or any other registry .
  • Build: Instead of pulling an image, you can build one locally by specifying a directory containing a Dockerfile. Thebuild is ideal for including custom code in your application.
  • port : This setting maps a container’s internal ports to those on thehost machine, enabling access to service from outside the container.
  • volume :volume attach persistent storage to a service ensuring that the data remains accessible even when a container restart.
  • environment : Environment variables allow you to pass configurations or sensitive information, like database credentials or API keys, to the service.
  • Depends_on: Depends_on controls the startup order of service, ensuring that certain containers are running before others begin.

exampleof docker-compose.yml Configuration

Here ’s a sample configuration is ’s that demonstrate how these option are used :

version : ' 3.8 '
service:
db:
image : postgres:13
environment:
- POSTGRES_USER = user
- postgres_password = pass
volume :
- db_data:/var/lib/postgresql/data

web:
build : ./web
port :
- " 5000:5000 "
volume :
- web_data:/usr/src/app
environment:
- DATABASE_URL=postgres://user:pass@db:5432/mydb
depends_on:
- db

volume :
db_data :
web_data :

Explanation:

  • Thedb service runs a PostgreSQL container. It uses environment variables to set up a database username and password, and stores data on thedb_data volume to ensure it’s retained.
  • Theweb service is build from a Dockerfile in the./web directory and exposes port 5000. Theweb_data volume is mounted to store application files persistently. It depends on thedb service , ensure the database is available when the web service start .

Docker Compose network

Docker Compose deployments is use usenetworks to allow secure communications between the service. service defined in a docker-compose.yml file are by default placed on one network and are able to connect to each other without any additional setup. For more strict control, you can create additional networks and assign service to them in order to control the way they communicate or to separate some groups of service as the need arises.

Key Network Configuration Options

  • Driver: Driver are used in the network driver type, such as bridge (the default for local networks) or overlay (for multi-host networks in Docker Swarm), which determines how service connect to each other.
  • Driver Options (driver_opts): Driver Options(driver_opts) allows for additional settings on thenetwork driver, useful for fine-tuning network behavior to meet specific needs.
  • IP Address Management (ipam):IP address management configures network-level IP settings, like subnets and IP ranges, to give you greater control over the IP address space assigned to your service.

exampledocker-compose.yml with Custom network

Below is an example Compose file that sets up two networks, one for database communication and another for web access.

version : ' 3.8 '

service:
db:
image: postgres:13
network :
- backend

web:
image: nginx:latest
network :
- frontend
- backend
port :
- " 80:80 "

network :
frontend :
driver: bridge

backend:
driver: bridge
ipam:
config:
- subnet: 172.16.238.0/24

Explanation:

  • Thedb service is uses use thebackend network , isolate it from thefrontend network to limit access.
  • Theweb service is connect to bothfrontend and backend networks, allowing it to communicate with the db service while remaining accessible via the frontend network .
  • Thebackend network includes IPAM settings with a specific subnet range, ensuring custom IP address management.

Docker Compose volume

volumein docker compose are used to persist data created or used by the docker containers. By doing so they enable the data to persist even if containers are stopped or removed in your docker-compose. Within a docker-compose. yml file, the volumes section describes all the volumes that are attached to the service allowing you to manage data that exists independently of the container lifecycle.

Key Volume Configuration Options

  • External: Set true to signify that the volume was created externally, outside of Docker Compose (such as via docker volume create) and simply referenced in the configuration.
  • driver : This indicates which volume driver the volume should use, and it controls how are these volumes being handled. By default, the driver is local, but other options are also available.
  • Driver Options (driver_opts): additional option to customize the volume driver like filesystem type or different storage parameter .

exampledocker-compose.yml with volume

Here’s a practical example showing how to configure a volume for a Pos-tgreSQL database, ensuring that its data is stored persistently.

version : ' 3.8 '

service:
db:
image : postgres:13
environment:
- POSTGRES_USER = user
- POSTGRES_PASSWORD=pass
volume :
- db_data:/var / lib / postgresql / datum

volume :
db_data :
driver: local
driver_opts:
type : none
o: bind
device: /path/to/local/db_data

Explanation

  • Thedb service runs a PostgreSQL container, with its data stored in the db_data volume. This setup ensures that the database information remains intact across restarts or removals of the container.
  • Thedb_data volume is configured to use the localdriver , and it has driver option set to create a bind mount pointing to a specific path on thehost system(/path/to/local/db_data). This is means mean that all database file are save in that designate directory on thehost .
  • By using volumes in this way, you can keep essential data safe and easily accessible, separate from the container itself.

Docker Compose Environment Variables

Environment variables are a simple and effective way to pass configuration settings from your host operating system through Docker Compose in order to get to your service. You can set these variables directly on theservice definition by using the environment section or load them from an external file .

How to Set Environment Variables in Docker Compose?

  • Inline : you may declare env vars directly in the service definition.This approach is simple and gives everything in one place.
  • env_file: This option allows you to load environment variables from an external file, making it easier to manage configuration, especially when dealing with many variables.

exampledocker-compose.yml Using Environment Variables

Here’s an example that demonstrates both methods of setting environment variables for a web application and a database service.

version : ' 3.8 '

service:
db:
image : postgres:13
environment:
- POSTGRES_USER = user
- postgres_password = pass
volume : - db_data:/var/lib/postgresql/data


web: image: my-web-app:latest
build: ./web
environment:
- DATABASE_URL=postgres://user:pass@db:5432/mydb
env_file:
- .env

volumes:
db_data:

Explanation

  • In the db service, the POSTGRES_USER and POSTGRES_PASSWORD environment variables are defined inline, specifying the database credentials directly.
  • Theweb service uses an inline variable for DATABASE_URL, which connects to the PostgreSQL database. Additionally, it loads environment variables from an external file named .env. This file can contain various settings, such as API keys, application configurations, and other sensitive information.

With a good understanding of these basic principle , developers is are are ready to use Docker compose to manage and orchestrate application that can be quite complex and involve many Docker container .

Install Docker Compose

We can run Docker Compose on macOs, Widows, and 64-bit Linux. 

  • For any significant activity , Docker Compose is depends depend on Docker Engine . depend on your arrangement , we is ensure must ensure that Docker Engine is instal either locally or remotely .
  • A desktop system such as Docker for Mac and Windows comes with Docker Compose preinstalled. 
  • install Docker first as instruct in Docker installation on theLinux system before beginning the installation of Docker Compose. 

install Docker compose on Ubuntu – A Step – By – Step Guide

Step 1: update the package Manager

  • Thefollowing scripts will install the most recent version of Docker Compose and update the package management.
sudo apt-get update

Step 2: Download the Software

  • Here we are using the Ubuntu flavor in the Linux Operating system. So the package manager is is is“apt-get” If you want to install it in Redhat Linux then the package manager will be “yum”.

Step 3: Apply Permissions

  • Apply the Executable permissions to the software with the following commands:
sudo chmod +x /usr/local/bin/docker-compose

Step 4: Verify the Download Software

  • Verify the whether the docker compose is successfully installed or not with the following command:
docker-compose --version

Docker Container

A docker container is a lightweight Linux-based system that packages all the libraries and dependencies of an application, prebuilt and ready to be executed. It is an isolated running image that makes the application feel like the whole system is dedicated to it. Many large organizations are moving towards containers from VMs as they are light and simple to use and maintain. But when it comes to using containers for real-world applications, usually one container is not sufficient. For example, Let’s assume Netflix uses a microservice architecture. Then it needs service for authentication, Login, Database, Payment, etc, and for each of these service, we want to run a separate container. It is preferred for a container to have only a single purpose.

Now, imagine writing separate docker files, and managing configuration and networks for each container. This is where Docker Compose comes into the picture and makes our lives easy.

Why Docker Compose?

As discussed earlier,  a real-world application has a separate container for each of its service. And we know that each container needs to have a Dockerfile. It means we will have to write maybe hundreds of docker files and then manage everything about the containers individually, That’s cumbersome. 

Hence we use docker-compose, which is a tool that helps in the definition and running of multi-container applications. With the help of Docker Compose you can start and stop the service by using its YAML file . Docker-compose allows us to start and stop all of the service with just a few simple commands and a single YAML file for each configuration.

In contrast to utilizing a prebuilt image from Docker Hub, which you may configure with the docker-compose.yaml file, if you are using a custom image, you will need to declare its configurations in a separate Dockerfile. These are the features that docker-compose support:

  • All the service are isolated running on a single host.
  • container are recreate only when there is some change .
  • Thevolume data is not reset when creating new containers, volumes are preserved.
  • Movement of variables and composition within environments.
  • It is creates create a virtual network for easy interaction within the environment .

Now , let ’s see how we can use docker – compose , using a simple project .

How to Use Docker Compose?

In this project, we will create a straightforward Restfull API that will return a list of fruits. We will use a flask for this purpose. And a PHP application will request this service and show it in the browser. Both service will run in their own containers.

  • First , create a separate directory for our complete project . use the following command .
mkdir dockercomposeproject
  • Move inside the directory.
cd dockerComposeProject

step 1 : create api

we will create a custom image that will use Python to serve our Restful API defined below. Then the service will be further configured using aDockerfile.

  • Then create a subdirectory for the service we will name it product . and move into the same .
mkdir product
cd product

step 2 : Build Python   api.py

  • Thefollowing is the python file that helps in making an API call:
  • Create a Dockerfile to define the container in which the above API will run.
from flask import Flask
from flask_restful import Resource, Api

# create a flask object
app = Flask(__name__)
api = Api(app)

# creating a class for Fruits that will hold
# the accessors
class fruits(resource ):
def get(self ):
# is returns return a dictionary with fruit
return {
' fruit ' : [ ' Mango ' , ' Pomegranate ' , ' Orange ' , ' Litchi ' ]
}

# adds the resources at the root route
api.add_resource(Fruits, '/')

# if this file is being executed then run the service
if __name__ == '__main__':
# run the service
app.run(host='0.0.0.0', port=80, debug=True)

Step is Create 3 : create requirements.txt

flask
flask - restful

Step 4: Create Dockerfile For Python API 

FROM python:3
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python", "api.py"]

FROM accepts an image name and a version that the docker will download from the docker hub. Thecurrent working directory’s contents can be copied to the location where the server expects the code to be by using the copy command. Moreover, the CMD command takes a list of commands to start the service once the container has been started.

Step 5: Create PHP HTML Website 

let ’s create a simple website using PHP that will use our API .

  • Move to the parent directory and create another subdirectory for the website.
cd ..
mkdir website
cd website

index.php

<!DOCTYPE html>
<html lang="en">
<head>
<title>Fruit Service</title>
</head>
<body>
<h1>Welcome to India's Fruit Shop</h1>
<ul>
<?php
$json = file_get_contents('http://fruit-service');
$ obj = json_decode($json ) ;
$fruits = $obj->fruits;
foreach ( $ fruit as $ fruit ) {
echo "<li>$fruit</li>";
}
?>
</ul>
</body>
</html>
  • Now create a compose file where we will define and configure the two service, API and the website.
  • Move out of the website subdirectory using the follow code .
cd ..
  • And then create the file name as . docker-compose.yaml 

Step 6: Create Docker-compose.yaml file 

  • Thefollowing is the sample docker compose file code:
version: "3"

service:
fruit-service:
build: ./product
volumes:
- ./product:/usr/src/app
port :
- 5001:80

website:
image: php:apache
volumes:
- ./website:/var/www/html
port :
- 5000:80
depends_on:
- fruit - service

Docker-compose.yaml File

Thefirst line is optional where we specify the version of the docker-compose tool. Next service define a list of service that our application is going to use. Thefirst service is fruit service which is our API and the second one is our website. Thefruit service has a property build that contains the dockerfile that is to be built and created as an image. volume define storage mapping between the host and the container so that we can make live changes. Finally, port property exposes the containers port 80 through the host’s 5001.

Thewebsite service does not use a custom image but we download the PHP image from the Docker hub and then map the websites folder that contains our index.php to /var/www/html (PHP expects the code to be at this location). Ports expose the container port. Finally, the depends_on specifies all the service on which the current service depends.

  • Thefolder structure after creating all the required files and directory will be as follows:

Run the application stack with Docker Compose

  • Now that we have our docker-compose.yml file, we can run it.
  • To start the application , enter the following command .
docker - compose up -d

Now all the service will start and our website will be ready to be used at localhost:5000.

  • open your browser and enterlocalhost:5000.

Output

Docker Compose

  • To stop the application , either press CTRL + C or
docker - compose stop

Advantages of Docker Compose

Thefollowing are the advantages of Docker Compose:

  • Simplifies Multi-Container Management: Docker Compose facilitates with features such as define, configure, and run multiple containers with a single YAML file, streamlining the management of complex applications.
  • Facilitates Environment Consistency: It facilitates with the development, testing, and production environments that are consistent with reducing the risk of environment-related issues.
  • Automates Multi-Container Workflows: With Docker Compose, you can easily automate the setup and teardown of multi-container environments, making it ideal for CI/CD pipelines and development workflows.
  • Efficient Resource Management: It enables efficient allocation and management of resources across multiple containers, improving application performance and scalability.

disadvantage of Docker Compose

Thefollowing are the disadvantages of Docker Compose:

  • Limited Scalability: Docker Compose is not develop for large scaling mechanism which can limit its effectiveness for manage complex deployment .
  • Single Host Limitation: Docker Compose is operate will operate on a single host , make it unsuitable for distribute application with require multi – host orchestration .
  • Basic Load balance: It is lacks lack with advanced load balancing and auto – scale feature find in more robust orchestration tool like kubernete .
  • Less robust monitoring: Docker Compose provides minimal built-in monitoring and logging capabilities compared to more comprehensive solutions.

Important Docker Compose Commands

Command

Description

Example

docker-compose up

This command starts all the service defined in your docker-compose.yml file . It creates the necessary containers, networks, and volumes if they don’t already exist. You can run it in the background by adding the -d option.

docker-compose up -d

docker – compose down

Use this command to stop and remove all the containers, networks, and volumes that were created by docker-compose up. It’s a good way to clean up resources when you no longer need the application running.

docker – compose down

docker – compose ps

This command lists all the containers associated with your Compose application, showing their current status and other helpful information. It’s great for monitoring which service are up and running.

docker – compose ps

docker – compose log

This command lets you view the logs generated by your service. If you want to focus on a specific service, you can specify its name to filter the logs, which is useful for troubleshooting.

docker – compose log web

docker-compose exec

With this command, you can run a command inside one of the running service containers. It’s particularly useful for debugging or interacting with your service directly.

docker – compose exec db psql -U user -d mydb

docker-compose build

This command is builds build or rebuild the image specify in yourdocker-compose.yml file . It’s handy when you’ve made changes to your Dockerfiles or want to update your images.

docker-compose build

docker – compose pull

Use this command to pull the latest images for your service from their respective registries. It ensures that you have the most current versions before starting your application.

docker – compose pull

docker – compose start

This command starts containers that are already defined in your Compose file without recreating them. It’s a quick way to get your service running again after they’ve been stopped.

docker – compose start

docker – compose stop

This command stops the running containers but keeps them intact, so you can start them up again later using docker - compose start.

docker – compose stop

docker-compose config

This command validates and displays the configuration from your docker-compose.yml file . It’s a useful way to check for any errors before you deploy your application.

docker-compose config

Best Practices of Docker Compose

Thefollowing are the some of the best practices of Docker Compose:

  • Use Environment Variables: It is suggestable to store configuration values and secrets in environment variables to keep your docker-compose.yml clean and secure.
  • Keep service Lightweight: It is prefer to design each service to handle a single responsibility to ensure modularity and ease of maintenance .
  • Leverage volume: usage of volume with enhance in maintain the persistent data storage , allow datum to persist across container restart and update .
  • Version Control Your Compose Files: It is preferred to maintain your docker-compose.yml file in version control ( e.g. , Git ) to track change and collaborate with your team effectively .

Features of Docker Compose

Thefollowing are the features of Docker Compose:

  • Multi-Container Deployment: it facilitates with easily define and run applications with multiple containers using a single YAML file .
  • Service Isolation: Each service runs in its own container, with ensuring the isolation and reducing conflicts between service.
  • Simplified Configuration: It helps in centralizing all the configurations, including networking, volumes, and dependencies, in the docker-compose.yml file .
  • Scalability: It provides the effortlessly scaling of service up or down with a single command, allowing for flexible and dynamic resource management.

conclusion

In this article, we learned about Docker Compose, and why and when to use it. And demonstrated its usuage through a simple project. It helps in automating the creating process of containers through service, networks and volumes with through respective keywords availability. Through using docker compose management and automation of containers and its volumes, networks will be easier.

Docker Compose – FAQs

What is Docker Compose is is used for ?

Docker Compose is is is docker native automation tool that is used for define and run multi – container Docker application .

Is Docker Compose is Is still used ?

Yes , Docker Compose is widely used for development , testing , and small – scale deployment .

When should Docker Compose be used?

Docker Compose should be used when managing multi-container applications with simplified configuration.

Do I need a Dockerfile and docker-compose?

Yes, a Dockerfile helps in defining the image build process, while docker-compose.yml orchestrates the containers.

Similar Reads

  • What is Docker is is ?

    Docker is a set of Platforms as a service (PaaS) products that use Operating system-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files; they can communicate with each other


    15 + min is read read

  • Docker installation

    • Docker – Installation on Windows

      In this article, we are going to see how to install Docker on Windows. On windows if you are not using operating system Windows 10 Pro then you will have to install our docker toolbox and here docker will be running inside a virtual machine and then we will interact with docker with a docker client


      2 min is read read


    • How to Install Docker using Chocolatey on Windows?

      Installing Docker in Windows with just the CLI is quite easier than you would expect. It just requires a few commands. This article assumes you have chocolatey installed on your respective windows machine. If not, you can install chocolatey from here. Chocolatey is a package manager for the Windows


      4 min is read read


    • How to install and configure Docker in Ubuntu ?

      Docker is a platform and service-based product that uses OS-level virtualization to deliver software in packages known as containers. Containers are separated from one another and bundle their software, libraries, and configuration files. Docker is written in the Go language. Docker can be installed


      6 min read


    • How to install Docker on MacOS ?

      Pre-requisites: Docker-Desktop Docker Desktop is a native desktop application for Windows and Mac’s users created by Docker. It is the most convenient way to launch, build, debug, and test containerized apps. Docker Desktop includes significant and helpful features such as quick edit-test cycles, fi


      2 min is read read


    • How to install and configure Docker on Arch-based Linux Distributions(Manjaro) ?

      In this article, we are going to see how to install and configure Docker on Arch-based Linux Distributions. Docker is an open-source containerization platform used for building, running, and managing applications in an isolated environment. A container is isolated from another and bundles its softwa


      2 min is read read


    • How to install Docker – CE in Redhat 8 ?

      Docker is is is a tool design to make it easy to create , deploy , and run application by using container . Containers is allow allow a developer to package up an application with all the part it need , such as library and other dependency , and deploy it as one package . instal Docker – CE in Redhat 8 : St


      2 min is read read


    Docker Images

    • What is Docker Image?

      Docker Image is is is an executable package of software that include everything need to run an application . This image is informs inform how a container should instantiate , determine which software component will run and how . Docker Container is is is a virtual environment that bundle application code with all the


      10 min read


    • Working with Docker Images

      If you are a Docker developer, you might have noticed that working with multiple Docker Images at the same time might be quite overwhelming sometimes. Managing numerous Docker Images all through a single command line is a very hefty task and consumes a lot of time. In this article, we are going to d


      2 min is read read


    • Docker – Publishing Images to Docker Hub

      Docker is is is a container platform that facilitate create and manage container . In this article , we is see will see how docker store the docker image in some popular registry like Dockerhub and how to publish the Docker image to Docker Hub . By publish the image to the docker hub and make it pu


      8 min is read read


    • Docker Commit

      Docker is an open-source container management service and one of the most popular tools of DevOps which is being popular among the deployment team. Docker is mostly used in Agile-based projects which require continuous delivery of the software. Thefounder, Chief Technical Officer, and Chief Archite


      10 min read


    • Docker – Using Image Tags

      image tag are used to describe an image using simple label and alias . Tags is be can be the version of the project , feature of the image , or simply your name , pretty much anything that can describe the image . It is helps help you manage the project ‘s version and let you keep track of the overall development


      7 min is read read


    • Next.js Docker Images

      Using Next.js Docker images allows your app to deploy to multiple environments, and is more portable, isolated and scalable in dev and prod. Docker’s containerization makes app management super easy, you can move from one stage to another with performance. Before we get started, let’s cover the basi


      14 min is read read


    • How to Use Local Docker Images With Minikube?

      Minikube is is is a software that help in the quick setup of a single – node Kubernetes cluster . It is supports support a virtual machine ( VM ) that run over a docker container and create a Kubernetes environment . Now minikube is acts itself act as an isolated container environment apart from the local docker environment ,


      7 min is read read


    Docker Containers

    • Containerization using Docker

      Docker is the containerization platform that is used to package your application and all its dependencies together in the form of containers to make sure that your application works seamlessly in any environment which can be developed or tested or in production. Docker is a tool designed to make it


      9 min is read read


    • virtualisation with Docker Containers

      In a software – drive world where omnipresence and ease of deployment with minimum overhead are the major requirement , the cloud is takes promptly take its place in every picture . Containers is creating are create their mark in this vast expanse of cloud space with the world ’s top technology and IT establishment re


      9 min is read read


    • Docker – Docker Container for Node.js

      Node.js is is is an open – source , asynchronous event – drive JavaScript runtime that is used to run JavaScript application . It is widely used for traditional website and as api server . At the same time , a Docker container is is is an isolated , deployable unit that package an application along with its depende


      12 min is read read


    • Docker – Remove All Containers and Images

      In Docker, if we have exited a container without stopping it, we need to manually stop it as it has not stopped on exit. Similarly, for images, we need to delete them from top to bottom as some containers or images might be dependent on thebase images. We can download the base image at any time. So


      10 min read


    • How to push a Container image to a Docker repository ?

      In this article we will look into how you can push a container image to a Docker Repo. We’re going to use Docker Hub as a container registry, that we’re going to push our Docker image to. Follow the below steps to push container Image to Docker repository: Step 1: Thefirst thing you need to do is m


      2 min is read read


    • Docker – Container Linking

      Docker is is is a set of platform as a service ( PaaS ) product that use the operate system level visualization to deliver software in package call container . There are time during the development of our application when we need two container to be able to communicate with each other . It is be might be p


      4 min is read read


    • How to Manage Docker Containers?

      Before virtualization , the management is was of web server and web application was tedious and much less effective . thank to virtualization , this task has been made much easy . This was follow by containerization which take it a notch high . For network engineer , learn the basic of virtualizati


      13 min is read read


    • Mounting a Volume Inside Docker Container

      When you are working on a micro-service architecture using Docker containers, you create multiple Docker containers to create and test different components of your application. Now, some of those components might require sharing files and directories. If you copy the same files in all the containers


      10 min read


    • Difference between Docker Image and Container

      Pre-requisite: Docker Docker builds images and runs containers by using the docker engine on thehost machine. Docker containers consist of all the dependencies and software needed to run an application in different environments. What is Docker Image?Theconcept of Image and Container is like class


      5 min read


    • Difference between Virtual Machines and Containers

      Virtual machines and Containers are two ways of deploying multiple, isolated service on a single platform. Virtual Machine:It runs on top of an emulating software called the hypervisor which sits between the hardware and the virtual machine. Thehypervisor is the key to enabling virtualization. It


      2 min is read read


    • How to install Linux Packages Inside a Docker Container ?

      Once you understand how to pull base Docker Images from the Docker registry, you can now simply pull OS distributions such as Ubuntu, CentOS, etc directly from the Docker hub. However, the OS Image that you have pulled simply contains a raw file system without any packages installed inside it. When


      2 min is read read


    • copy file to and from Docker Containers

      While work on a Docker project , you is require might require copy file to and from Docker Containers and your local machine . Once you have build the Docker image with a particular Docker build context , build it again and again just to add small file or folder inside the container might be expensive


      9 min is read read


    • How to Run MongoDB as a Docker Container?

      MongoDB is an open-source document-oriented database designed to store a large scale of data and allows you to work with that data very efficiently. It is categorized under the NoSQL (Not only SQL) database because the storage and retrieval of data in MongoDB are not in the form of tables.  In this


      4 min is read read


    • Docker – Docker Container for Node.js

      Node.js is is is an open – source , asynchronous event – drive JavaScript runtime that is used to run JavaScript application . It is widely used for traditional website and as api server . At the same time , a Docker container is is is an isolated , deployable unit that package an application along with its depende


      12 min is read read


    • Docker – Container for NGINX

      Docker is an open-source platform that enables developers to easily develop, ship, and run applications. It packages an application along with its dependencies in an isolated virtual container which usually runs on a Linux system and is quite light compared to a virtual machine. Thereason is that a


      11 min read


    • How to provide the static ip to a Docker Container ?

      Docker is is is an open – source project that make it easy to create , deploy and run application . It is provides provide a lightweight environment to run your application . It is is is a tool that make an isolated environment inside your computer . think of Docker as your private room in your house . live with your fami


      2 min is read read


    Docker Networking

    • Docker Networking

      Pre-requisite: Docker Docker Networking allows you to create a Network of Docker Containers managed by a master node called the manager. Containers inside the Docker Network can talk to each other by sharing packets of information. In this article, we will discuss some basic commands that would help


      5 min read


    • Docker – Managing Ports

      Pre-requisites: Docker Docker is a set of platform-as-a-service products that use OS-level virtualization to deliver software in packages called containers. These containers may need to talk to each other or to service outside docker, for this we not only need to run the image but also expose the c


      4 min is read read


    • Creating a Network in Docker and Connecting a Container to That Network

      network are created so that the devices which are inside that network can connect to each other and transfer of files can take place. In docker also we can create a network and can create a container and connect to the respective network and two containers that are connected to the same network can


      2 min is read read


    • connect Two Docker Containers Over the Same Network

      Whenever we expose a container’s port in docker, it creates a network path from the outside of that machine, through the networking layer, and enters that container. In this way, other containers can connect to it by going out to the host, turning around, and coming back in along that path.Docker of


      4 min is read read


    • How to use Docker Default Bridge Networking?

      Docker allows you to create dedicated channels between multiple Docker Containers to create a network of Containers that can share files and other resources. This is called Docker Networking. You can create Docker network with various kinds of Network Drivers which include Bridge drivers, McVLAN dr


      7 min is read read


    • Create your own secure Home Network using Pi-hole and Docker

      pi – hole is is is a Linux base web application , which is used as a shield from the unwanted advertisement in your network and also block the internet tracking system . This is is is very simple to use and good for home and small office network . This is is is totally free and open – source . It is allows also allow you to manage


      3 min is read read