-->

ABOUT US

Our development agency is committed to providing you the best service.

OUR TEAM

The awesome people behind our brand ... and their life motto.

  • Kumar Atul Jaiswal

    Ethical Hacker

    Hacking is a Speed of Innovation And Technology with Romance.

  • Kumar Atul Jaiswal

    CEO Of Hacking Truth

    Loopholes are every major Security,Just need to Understand it well.

  • Kumar Atul Jaiswal

    Web Developer

    Techonology is the best way to Change Everything, like Mindset Goal.

OUR SKILLS

We pride ourselves with strong, flexible and top notch skills.

Marketing

Development 90%
Design 80%
Marketing 70%

Websites

Development 90%
Design 80%
Marketing 70%

PR

Development 90%
Design 80%
Marketing 70%

ACHIEVEMENTS

We help our clients integrate, analyze, and use their data to improve their business.

150

GREAT PROJECTS

300

HAPPY CLIENTS

650

COFFEES DRUNK

1568

FACEBOOK LIKES

STRATEGY & CREATIVITY

Phasellus iaculis dolor nec urna nullam. Vivamus mattis blandit porttitor nullam.

PORTFOLIO

We pride ourselves on bringing a fresh perspective and effective marketing to each project.

  • FOR Loop in Batch Scripting with Examples

     

    FOR Loop in Batch Scripting with Examples


    FOR Loop in Batch Scripting with Examples


    When working with Batch Scripts, you may need to repeat the same task multiple times. Instead of writing the same command again and again, you can use a **FOR Loop**.

    The FOR Loop helps automate repetitive tasks such as displaying values, creating folders, processing files, and running commands multiple times.

    In this tutorial, we'll learn the basics of the FOR Loop using simple examples.



    What is a FOR Loop?


    A FOR Loop executes a block of code repeatedly for each item in a list.

    Syntax


    for %%variable in (list) do (
        command
    )


    Where:
     

    • `%%variable` stores the current value.
    • `list` contains the items to process.
    • `do` specifies the command to execute.



    Example 1: Display Numbers Using FOR Loop


    @echo off
    setlocal
    for %%i in (1 2 3 4 5) do (
        echo %%i
    )


    Output

    1
    2
    3
    4
    5



    Explanation


    In this example:

    • `%%i` acts as the loop variable.
    • The loop processes each value one by one.
    • The `echo` command displays the current value.



    Execution Flow:


    Iteration 1 → 1
    Iteration 2 → 2
    Iteration 3 → 3
    Iteration 4 → 4
    Iteration 5 → 5



    Example 2: Create Multiple Folders


    @echo off
    setlocal
    for %%i in (1 2 3 4 5) do (
        mkdir Folder-atul-%%i
    )

     

    Result


    The script creates the following folders:


    Folder-atul-1
    Folder-atul-2
    Folder-atul-3
    Folder-atul-4
    Folder-atul-5


     

    FOR Loop in Batch Scripting with Examples

     

     

     

    Explanation

    For each number:

    * The loop runs once.
    * `mkdir` creates a new folder.
    * `%%i` is appended to the folder name.

    This saves time compared to manually creating multiple folders.



    Why Use FOR Loops?


    FOR Loops are useful when:

    • * Creating multiple folders
    • * Renaming files
    • * Processing log files
    • * Running repetitive commands
    • * Automating administrative tasks




    Instead of writing:


    mkdir Folder1
    mkdir Folder2
    mkdir Folder3
    mkdir Folder4
    mkdir Folder5


    you can use a single FOR Loop.


    Real-World Uses for System Engineers

    System Engineers commonly use FOR Loops for:

    • Bulk folder creation
    • File management
    • Log collection
    • Backup automation
    • Software deployment tasks
    • User account processing



    FOR Loops are one of the most frequently used automation tools in Batch Scripting.





    Interview Questions


    What is a FOR Loop?
    A FOR Loop is used to repeat a command for each item in a list.


    What does %%i represent?
    It is the loop variable that stores the current value during each iteration.


    Why are FOR Loops useful?
    They reduce repetitive code and automate repetitive tasks.


    Which command is used to create folders?
    mkdir


    Can FOR Loops be used in automation scripts?
    Yes. They are widely used in system administration and automation tasks.



    Conclusion


    The FOR Loop is one of the most powerful features of Batch Scripting. It allows you to repeat tasks efficiently and automate routine operations. Whether you're displaying values, creating folders, or processing files, mastering FOR Loops will make your scripts cleaner and more effective.

    As a future System Engineer or SecDevOps professional, understanding loops is an important step toward automation and scripting mastery.
     

     

     

     

  • IF Statement and IF ELSE Statement in Batch Scripting

     

     

    IF Statement and IF ELSE Statement in Batch Scripting



    IF Statement and IF ELSE Statement in Batch Scripting



    When writing Batch Scripts, we often need to make decisions based on conditions. This is where the IF and IF ELSE statements are used.

    They allow a script to perform different actions depending on whether a condition is true or false.

    In this tutorial, we will learn how to use IF and IF ELSE statements with practical examples.

     

     

    What is an IF Statement?


    An IF statement executes a block of code only when a specific condition is true.

    Syntax

    if condition (
        command
    )



    Example 1: Basic IF Statement



      
    @echo off
    
    goto:main
    :main
    
    set /A number=5
    if %number% equ 5 (echo This is IF statement)
    
    goto:eof
    
      



    Output

    This is IF statement




    Explanation


    In this example:

    • A variable named number is created.
    • The value of number is set to 5.
    • The IF statement checks whether the value equals 5.
    • Since the condition is true, the message is displayed.



    The keyword:

    equ
    means equal to.


    Example 2: Checking a User Path



      
      @echo off
    
    goto:main
    
    :main
    
    set /P path= Enter path
    if %path% EQU C:\Users\user\Desktop\batch-scripting (
        cd %path%
        dir
    
    )
    
    goto:eof 
     
     
     
    IF Statement and IF ELSE Statement in Batch Scripting

     



    How It Works


    User enters a path.
    Batch compares the entered value with the specified path.

    If both match:

    • The script changes to that directory.
    • The contents of the folder are displayed using dir.



    Sample Input
    C:\Users\user\Desktop\batch-scripting


    Sample Output
    Directory of C:\Users\user\Desktop\batch-scripting


    This type of validation is commonly used in automation scripts.



    What is an IF ELSE Statement?


    The IF ELSE statement allows us to execute one block of code when a condition is true and another block when the condition is false.


    Syntax

    if condition (
        commands
    ) else (
        commands
    )



    Example: IF ELSE Statement


      
    @echo off
    goto:main
    :main
    set /P path= Enter path
    if %path% EQU C:\Users\user\Desktop\batch-scripting (
        cd %path%
        dir
    )
     else (
        echo Invalid path
    )
    goto:eof
    
      



    Explanation


    The script checks the path entered by the user.

    If the path is correct
    C:\Users\user\Desktop\batch-scripting


    The script:

    • Changes to the directory
    • Displays folder contents
    • If the path is incorrect
    • D:\Projects


    The script displays:

    Invalid path

    This makes scripts more user-friendly because they can handle both valid and invalid inputs.



    Common Comparison Operators


    IF Statement and IF ELSE Statement in Batch Scripting



    Example


    if %number% GTR 10 (
        echo Number is greater than 10
    )



    Real-World Uses of IF Statements


    System Engineers and IT Administrators commonly use IF statements for:

    • Checking whether a file exists
    • Validating folder paths
    • Verifying user input
    • Monitoring services
    • Automating troubleshooting tasks
    • Running backup scripts



    Interview Questions



    What is an IF statement in Batch Scripting?
    An IF statement executes commands only when a specified condition is true.


    What is the purpose of ELSE?
    ELSE executes an alternative block of code when the IF condition is false.


    What does EQU mean?
    EQU stands for "Equal To".


    Which command is used to take user input?
    set /P


    Why are IF statements important?
    They allow scripts to make decisions and automate tasks based on conditions.



    Conclusion


    The IF and IF ELSE statements are fundamental concepts in Batch Scripting. They help automate decision-making and make scripts more interactive. Whether you are validating user input, checking files, or automating system administration tasks, conditional statements are an essential skill for every Batch Scripting learner.




  • Local Scope vs Global Scope in Batch Scripting

     

    Local Scope vs Global Scope in Batch Scripting

     

     Understanding Local Scope and Global Scope in Batch Scripting



    Variables are one of the most important components of Batch Scripting. As scripts become larger, managing variables properly becomes essential. This is where the concepts of Local Scope and Global Scope come into play.

    In this article, we will understand how SETLOCAL and ENDLOCAL work and how they affect variable visibility inside a Batch Script.

    Learn Local Scope and Global Scope in Batch Scripting with practical examples. Understand SETLOCAL, ENDLOCAL, variable visibility, and best practices for Windows automation and System Administration.

    What is Variable Scope?


    Variable scope determines where a variable can be accessed within a script.

    In Batch Scripting there are two common scopes:

    • Global Scope
    • Local Scope


    Understanding the difference helps prevent unexpected behavior when writing automation scripts.

     

    Understanding SETLOCAL


    Example Script

      
      
    @echo off
    
    goto :displayname
    
    :displayname
    setlocal
    set /P name=Enter your name:
    echo Hello, %name%!
    endlocal
    
    goto: eof
      



    The command:

    setlocal

    creates a local environment.

    Any variable created after SETLOCAL exists only inside that local block.

    Example:

    setlocal
    set name=Atul

    The variable name is local.
    Once the script reaches:
    endlocal
    the variable disappears.




    Understanding ENDLOCAL

    @echo off
    
    goto :displayname
    
    :displayname
    setlocal
    set /P name=Enter your name:
    echo Hello, %name%!
    endlocal
    
    set /P number=Enter a number:
    echo You entered: %number%
    
    goto: eof
    
    


    The command:

    endlocal

    terminates the local environment and restores the previous environment.

    Example:

    • setlocal
    • set name=Atul
    • endlocal

    After ENDLOCAL, the variable:

    %name%

    is no longer available.





     


    Step-by-Step Execution of the Script



    Step 1

    Execution starts here:

    • goto :displayname
    • Control jumps to:
    • :displayname





    Step 2

    A local environment is created:

    • setlocal

    Now all variables created afterward are local.




    Step 3

    User enters a name:

    • set /P name=Enter your name:




    Example:
    Enter your name: Atul



    Variable value:
    name = Atul



    Step 4

    Display the value:
    echo Hello, %name%!


    Output:
    Hello, Atul!



    Step 5

    Local environment ends:
    endlocal

     

    Now the variable:
    name
    no longer exists.


    Step 6

    User enters another value:
    set /P number=Enter a number:


    Example:

    25

    Since this variable is declared outside the local block, it remains available.

    Output:
    You entered: 25


    What is Global Scope?


    A global variable is accessible throughout the entire script.


    Example:

      
    @echo off
    
    set company=HackingTruth
    
    echo %company%
    
    goto:eof
      


    Output:

    HackingTruth


    The variable remains available until:

    • Script ends
    • Variable is modified
    • Variable is deleted



    Example of Local Scope


      @echo off
    setlocal
    
    set username=Atul
    echo %username%
    
    endlocal
    echo %username%
      


    Output:
    Atul

    Second output:

    (blank)

    Because username exists only inside the local environment.



    Example of Global Scope

    @echo off
    
    set username=Atul
    
    echo %username%
    
    echo %username%
    



    Output:

    Atul
    Atul

    The variable is available everywhere in the script.


    Why Use Local Scope?


    Local variables are useful when:

    • Creating reusable functions
    • Preventing accidental variable modification
    • Testing code
    • Building large automation scripts


    Benefits:

    • Better script organization
    • Reduced bugs
    • Cleaner variable management

     

     

     

    Real-World Example


    Suppose a System Engineer writes a backup script.

    Without local scope:

    • set backup=C:\Backup
    • Another function may accidentally overwrite:
    • set backup=D:\Temp




    Result:

    • Backup process fails
    • Wrong directory used


    Using SETLOCAL prevents such conflicts.




    Preserving a Variable After ENDLOCAL


    Sometimes you want to keep a variable after ENDLOCAL.

    Example:

      @echo off
    setlocal
    set username=Atul
    endlocal & set username=%username%
    echo %username%
      



    Output:

    Atul

    This technique is commonly used in advanced Batch scripts.




    Local Scope vs Global Scope

     

    Local Scope vs Global Scope in Batch Scripting



    Real-World Uses for System Engineers



    Local Scope is useful for:

    • Software deployment scripts
    • Backup automation
    • User provisioning scripts
    • Active Directory automation
    • Network troubleshooting tools
    • System inventory collection




    Global Scope is useful for:

    • Configuration values
    • Common paths
    • Server names
    • Shared settings




    Interview Questions



    What is SETLOCAL in Batch Scripting?

    • SETLOCAL creates a local environment where variables exist only within that block.


    What is ENDLOCAL?

    • ENDLOCAL ends the local environment and removes local variables.


    What is the difference between Local Scope and Global Scope?

    • Local variables are available only inside a SETLOCAL block, while global variables remain available throughout the script.


    Why should System Engineers use SETLOCAL?

    • It prevents variables from interfering with other parts of the script and improves maintainability.


    What happens to variables after ENDLOCAL?

    • They are removed unless specifically preserved.



    Conclusion


    Understanding Local Scope and Global Scope is essential for writing professional Batch Scripts. Using SETLOCAL and ENDLOCAL allows you to create safer and more maintainable automation scripts. As your scripts grow in complexity, proper scope management becomes increasingly important.

    For aspiring System Engineers and future SecDevOps professionals, mastering variable scope is a foundational skill that helps build reliable Windows automation solutions.





  • Batch Scripting Functions Explained: CALL, GOTO, EXIT and EXIT /B with Examples

     

     

    Understanding Functions in Batch Scripting: CALL, GOTO, EXIT, and EXIT /B

     

     

    Understanding Functions in Batch Scripting: CALL, GOTO, EXIT, and EXIT /B


    As batch scripts become larger, writing all commands in a single block can make the script difficult to maintain. Functions help organize code into reusable sections, making scripts easier to read and manage.

    In this article, we will learn how functions work in Batch Scripting using labels, the CALL command, GOTO, EXIT, and EXIT /B.

    Learn Batch Scripting functions with practical examples. Understand CALL, GOTO, GOTO :EOF, EXIT, and EXIT /B to build reusable Windows automation scripts for System Administration and System Engineering.

     

    What is a Function in Batch Scripting?


    Unlike programming languages such as Python or Java, Batch scripting does not have traditional functions. Instead, functions are simulated using labels.

    A label begins with a colon (:).


    Example:

    :function1
    
    You can jump to a label using:
    
    goto:function1
    
    or call it using:
    
    call:function1
      

     

    Basic Function Example

      
      
    @echo off 
    :function1
    
    echo This is function 1
    
    :function2
    
    echo This is function 2
    
    call:function1
      

    Explanation


    In this script:

    Two labels are created.
    function1 prints a message.
    function2 prints another message.
    call:function1 invokes function1.



    Output

    This is function 1
    This is function 2
    This is function 1



    Important Note

    Without goto statements, Batch continues reading the script from top to bottom, executing labels as it encounters them. 

     

    Using GOTO to Control Execution



    The goto command transfers execution directly to a specific label.

    Example:

      
      @echo off
    
    goto:function3
    
    :function1
        echo This is function 1
    
    :function2
        echo This is function 2
        goto:eof
    
    :function3
        echo This is function 3
        call:function1
      




    How It Works


    Step 1

    Script starts at:

    • goto:function3
    • Execution jumps directly to:
    • :function3




    Step 2

    Output:

    • This is function 3



    Step 3

    • call:function1 executes:
    • This is function 1


    Output


    This is function 3
    This is function 1

    Notice that function2 is skipped because execution never reaches it.




    Understanding GOTO


    One of the most useful statements in Batch scripting is:

    • goto:eof


    EOF means End Of File.



    When a called function reaches:

    • goto:eof


    execution returns to the line immediately after the CALL statement.



    Example:



    • :function2
    • echo This is function 2
    • goto:eof


    This behaves similarly to a return statement in other programming languages.

    Function Example with EXIT



    Example:

      
      
    @echo off
    
    goto:function3
    
    :function1
        echo This is function 1
    
    :function2
        echo This is function 2
        timeout 5
    exit
    
    :function3
        echo This is function 3
        call:function1
    
      


    Explanation

    Here:

    • exit


    terminates the entire Command Prompt session.

    If this script reaches the exit command:

    • CMD window closes.
    • Remaining commands do not execute.



    Why Use EXIT?


    Useful for:

    Ending automation tasks
    Stopping deployment scripts
    Exiting maintenance operations

    However, it should be used carefully because it closes the current command interpreter.



    Understanding EXIT /B


    A safer alternative is:

    exit /B

    Example:

      
      @echo off
    
    goto:function3
    
    :function1
        echo This is function 1
    
    :function2
        echo This is function 2
        exit /B 0
    
    :function3
        echo This is function 3
        call:function1
    
    
      


    What Does EXIT /B Do?


    Instead of terminating CMD:

    • exit /B

    only exits the current function or batch script context.



    The command:

    • exit /B 0


    returns an exit code of 0.



    Meaning of Exit Codes


    Batch Scripting Functions Explained: CALL, GOTO, EXIT and EXIT /B with Examples

     

     

     CALL vs GOTO



    Many beginners confuse these commands.

    • CALL
    • call:function1
    • Executes the function
    • Returns to the next line after completion



    Example:


    • Start
    • Function1
    • Back to Start
    • GOTO
    • goto:function1
    • Jumps permanently
    • Does not return automatically




    Example:

    • Start
    • Function1


    Execution continues from the new location.




    Real-World Uses for Functions



    Functions are useful when:


    • Displaying menus
    • Automating backups
    • Creating reusable code blocks
    • Network troubleshooting scripts
    • Software deployment scripts
    • User management automation
    • System information collection



    Instead of writing the same commands repeatedly, create one function and call it whenever needed.



    Practical Example: System Information Function

     

    @echo off
    
    call:sysinfo
    goto:eof
    
    :sysinfo
    echo Hostname:
    hostname
    
    echo.
    echo Current User:
    whoami
    
    echo.
    echo IP Configuration:
    ipconfig
    
    goto:eof
    

     

     


    Benefits:


    • Cleaner code
    • Easier maintenance
    • Reusable logic


    Interview Questions


    What is a function in Batch Scripting?

    A function is a labeled section of code that can be executed using the CALL command.



    What is the difference between CALL and GOTO?

    CALL returns to the original location after execution, while GOTO permanently jumps to another label.



    What does GOTO do?

    It exits the current function and returns control to the calling statement.



    What is EXIT /B?

    It exits the current batch context without closing the entire Command Prompt window.



    Why are functions useful?

    Functions improve code reusability, readability, and maintainability.



    Conclusion



    Functions are one of the most important concepts in Batch scripting. By understanding labels, CALL, GOTO, GOTO :EOF, EXIT, and EXIT /B, you can write structured and reusable scripts rather than long, repetitive command files.

    For System Engineers and future SecDevOps professionals, mastering functions is essential because real-world automation scripts often depend on reusable code blocks and proper flow control.


  • Batch Scripting Basics for Beginners: Variables, Comments, User Input, and Arithmetic Operations

     

    Batch Scripting Basics for Beginners: Variables, Comments, User Input, and Arithmetic Operations

     

     

    Batch Scripting Basics for Beginners: Variables, Comments, User Input, and Arithmetic Operations


    Batch scripting is one of the easiest ways to automate tasks in Windows. A batch file contains a series of commands that are executed by the Windows Command Prompt (CMD). System Administrators, IT Support Engineers, and System Engineers often use batch files for automation, troubleshooting, software deployment, and maintenance tasks.

    In this article, we will explore some fundamental concepts of batch scripting, including displaying output, using comments, working with variables, accessing environment variables, and performing arithmetic operations.




    Displaying Output with ECHO


    The echo command is used to display messages on the screen.


    echo off
    echo "Hello World from a batch file!"
    echo 1234
    echo Hello Atul
      


    Output

    "Hello World from a batch file!"
    1234
    Hello Atul



    Explanation

    • echo off hides the execution of commands.
    • echo displays text on the console.
    • It is commonly used to provide status messages to users.


    Understanding @ Symbol


    The @ symbol prevents the current command from being displayed before execution.


    //echo off
    @echo "This is for symbol.bat file"
    @vol
    @ver
    



    Explanation

    • @echo displays text without showing the command itself.
    • vol displays volume information of the current drive.
    • ver displays the Windows version.



    Sample Output

    "This is for symbol.bat file"
    Volume in drive C is Windows
    Volume Serial Number is XXXX-XXXX

    Microsoft Windows [Version 10.0.19045.XXXX]



    Working with Variables


    Variables are used to store values that can be reused throughout the script.


    @echo off
    rem set filename=echo.bat
    rem echo The name of the batch file is: %filename%
    set filename=dir
    echo The name of the batch file is: 
    %filename%
    
    


    Explanation

    • set creates a variable.
    • %filename% retrieves the stored value.
    • In this example, the variable contains the value dir.



    Output

    The name of the batch file is:

    Directory of C:\Users\Username

    Because %filename% contains the command dir, CMD executes it.



    Comments in Batch Files


    Comments help document scripts and improve readability.

    @echo off

    :: This is a comment in a batch file. It will not be executed.

    rem This is another way to write a comment in a batch file.
    echo This line will be executed, but the comments above will be ignored.




    Explanation

    There are two ways to write comments:

    REM
    ::

    Comments are ignored during execution and are useful for documenting code.

    Environment Variables

    Windows provides several built-in environment variables that contain system information.


    @echo off
    rem set
    ::cd %SystemRoot%
    ::dir
    
    echo Below is the cmd path
    echo %cmdcmdline%
    ::%ComSpec%
    echo %ComSpec%
    



    Explanation

    • %cmdcmdline%
    • Displays the command line that started the current CMD session.
    • %ComSpec%
    • Displays the path of the Command Prompt executable.



    Example Output

    Below is the cmd path
    C:\Windows\System32\cmd.exe

    C:\Windows\System32\cmd.exe

    These variables are useful when troubleshooting Windows systems.





    Arithmetic Operations


    Batch scripting supports basic mathematical calculations using set /a.


    @echo off
    
    set /a sum = 10+10
    echo The sum of 10 and 10 is: %sum%
    Output
    The sum of 10 and 10 is: 20
    More Arithmetic Examples
    
    Addition
    
    set /a result=15+5
    echo %result%
    
    Subtraction
    
    set /a result=20-5
    echo %result%
    
    Multiplication
    
    set /a result=5*5
    echo %result%
    
    Division
    
    set /a result=100/10
    echo %result%
    
    Modulus (Remainder)
    
    set /a result=10%%3
    echo %result%
    
    




    These operations are frequently used in automation scripts.




    Taking User Input


    Batch files can interact with users using set /p.


    @echo off
    
    rem echo Enter your name
    rem set /P name=
    
    rem echo Hello %name%, welcome to batch scripting!
    
    echo Enter the first number:
    set /P numb1=
    
    echo Enter the second number:
    set /P numb2=
    
    set /A sum = %numb1%+%numb2%
    
    echo %sum%
    
    



    Sample Execution

    Enter the first number:
    10

    Enter the second number:
    20

    30



    Explanation

    • set /p accepts input from the keyboard.
    • Values entered by the user are stored in variables.
    • set /a performs arithmetic calculations using those variables.


    This technique is commonly used in interactive administration scripts.

     

    Real-World Usage for System Engineers


    Batch scripting is useful for:

    • Automating repetitive tasks
    • Running maintenance scripts
    • Gathering system information
    • Managing files and folders
    • Creating startup and login scripts
    • Troubleshooting Windows systems
    • Automating software installation


    Even though modern organizations prefer PowerShell for advanced automation, understanding Batch scripting remains valuable because many legacy systems still use .bat files.


    Conclusion


    Batch scripting provides a simple way to automate Windows tasks. By learning commands such as echo, set, rem, environment variables, arithmetic operations, and user input handling, you build a strong foundation for Windows administration and automation.

     

     

     

  • docker-multi-container-applications-guide


    docker-multi-container-applications-guide

     

    Multi-Container Applications in Docker: A Beginner's Guide



    Modern applications rarely run inside a single container. In real-world production environments, different components of an application are separated into multiple containers. This approach improves scalability, maintainability, security, and performance.

    In this guide, you'll learn what multi-container applications are, why they are important, and how Docker Networks and Docker Volumes help containers communicate and store data efficiently.

     

    What Are Multi-Container Applications?



    A multi-container application consists of multiple Docker containers working together to provide a complete service.

    For example, a typical web application may have:


    • React Frontend
    • Node.js Backend API
    • MongoDB Database



    Instead of running everything inside one container, each service runs in its own container. 

     

    React Frontend
          │
          ▼
    Node.js Backend
          │
          ▼
    MongoDB Database
    
    



    This architecture follows the principle of separation of concerns, making applications easier to manage and scale.

     

     

    Example Multi-Container Architecture



    A typical Docker application may look like this:

    Container 1: Frontend
    Technology: React
    Port: 3000


    Container 2: Backend
    Technology: Node.js
    Port: 5000


    Container 3: Database
    Technology: MongoDB
    Port: 27017

     

     

    Frontend Container (React)
             │
             ▼
    Backend Container (Node.js)
             │
             ▼
    Database Container (MongoDB)
    

     

     
    All containers communicate through a Docker Network.

     


    Why Use Multiple Containers?



    Using separate containers provides several advantages:

    Better Scalability

    You can scale only the service that needs additional resources.


    Example:

    • 1 MongoDB container
    • 3 Backend containers
    • 2 Frontend containers


     

    Easier Maintenance



    If the backend crashes, you can restart only the backend container without affecting the frontend or database.



    Improved Security


    Each service runs in an isolated environment.


    Independent Updates



    Frontend, backend, and database can be updated separately. 

     

    Creating a MongoDB Container



    Start a MongoDB container:

    docker run -d --name mongodb mongo

    Docker downloads the MongoDB image and runs it in the background.

     

    Creating a Custom Docker Network


    Before connecting containers, create a network:

    docker network create mynetwork


    Verify:

    docker network ls

    Docker networks allow containers to communicate using container names instead of IP addresses.

    Starting the Backend Container



    Run the backend container on the custom network:

    • docker run -d --name backend --network mynetwork node




    The backend can now communicate with other containers attached to the same network.


    Starting the Frontend Container

    Run the frontend container:

    • docker run -d --name frontend --network mynetwork react-app




    Now all services are connected through the Docker network.

    Docker Volumes for Persistent Data
    Containers are temporary by nature. If a database container is deleted, its data may be lost.
    Docker Volumes solve this problem.



    Create a Volume

    • docker volume create mydata



    List available volumes:

    • docker volume ls
    • Attach Volume to a Container
    • docker run -v mydata:/app/data nginx


     
    Benefits of Docker Volumes:

    • Persistent storage
    • Data survives container deletion
    • Easy backup and migration
    • Real-World Example: hackingtruth.org


    Imagine hosting hackingtruth.org using Docker.

     

    Application Stack:


    • React Frontend
    • Node.js Backend
    • MongoDB Database

     

    Production Architecture:

     

    Frontend Container
            │
            ▼
    Backend Container
            │
            ▼
    MongoDB Container
    

     



    Supporting Components:



    Docker Network → Container communication
    Docker Volume → Database storage
    Multi-Container Architecture → Service separation


    This setup closely resembles how modern applications are deployed in cloud environments.

     

     

    Essential Commands



    Create Volume
    docker volume create mydata


    List Volumes
    docker volume ls


    Create Network
    docker network create mynetwork


    List Networks
    docker network ls


    Run Container with Volume
    docker run -v mydata:/app/data nginx


    Run Container on a Network
    docker run --network mynetwork nginx


     

    Benefits of Multi-Container Applications


    • Better scalability
    • Easier troubleshooting
    • Improved security
    • Independent deployments
    • Simplified maintenance
    • Production-ready architecture


    These advantages make multi-container applications the preferred approach in modern DevOps and cloud-native environments.



    Conclusion



    Multi-container applications are a fundamental concept in Docker and modern application deployment. By separating frontend, backend, and database services into individual containers, organizations achieve better scalability, reliability, and maintainability.

    Combined with Docker Networks and Docker Volumes, multi-container architecture provides the foundation for deploying professional-grade applications in production environments. Learning these concepts is essential for anyone pursuing a career in DevOps, Cloud Engineering, System Administration, or Software Development.

     

     

  • docker-compose-react-node-deployment-troubleshooting

     

    docker-compose-react-node-deployment-troubleshooting

     

     

     

    Docker Compose, React & Node.js Deployment, and Container Troubleshooting Guide


    As applications grow, managing multiple Docker containers manually becomes difficult. Imagine starting separate containers for React, Node.js, MongoDB, Redis, and Nginx every time you want to run your project.

    Docker Compose solves this problem by allowing you to define and manage multi-container applications using a single configuration file.

    In this guide, you'll learn Docker Compose, deploying React and Node.js applications, and common container troubleshooting techniques.


    What is Docker Compose?


    Docker Compose is a tool that allows you to define and run multiple Docker containers using a single YAML configuration file.

    Instead of running multiple commands manually:

      
    docker run ...
    docker run ...
    docker run ...
    
      



    You can define everything inside a single file:

    docker-compose.yml

    and start all services with one command. 

     

     

    Why Use Docker Compose?



    Benefits include:

    • Simplified container management
    • Easy multi-container deployments
    • Better configuration management
    • Consistent development environments
    • Faster application startup


    Docker Compose is commonly used for:

    • React Applications
    • Node.js APIs
    • MongoDB Databases
    • Redis Caching
    • Nginx Reverse Proxies

     

     

    Understanding docker-compose.yml


    A basic Docker Compose file looks like this:


    In this example:

    frontend runs the React application
    backend runs the Node.js API
    database runs MongoDB

    All services are automatically connected through an internal Docker network.

     

    version: '3'
    
    services:
      frontend:
        image: react-app
    
      backend:
        image: node-app
    
      database:
        image: mongo
    
    

     

     

     In this example:

    • frontend runs the React application
    • backend runs the Node.js API
    • database runs MongoDB


    All services are automatically connected through an internal Docker network. Learn Docker Compose, deploy React and Node.js applications, and master container troubleshooting with practical examples. A beginner-friendly guide for DevOps and System Engineers.

    Starting Docker Compose


    Run:

    • docker compose up


    Docker will:

    • Create networks
    • Create containers
    • Start services
    • Connect containers


    To run in the background:

    • docker compose up -d
    • Stopping Docker Compose


    Stop all services:

    • docker compose down


    Docker removes containers and networks created by Compose.

     

     Deploying a React Application

      
    FROM node:22
    
    WORKDIR /app
    
    COPY package*.json ./
    
    RUN npm install
    
    COPY . .
    
    EXPOSE 3000
    
    CMD ["npm","start"]
      


    Suppose you have a React application.

    Create a Dockerfile:


    Build the image:

    • docker build -t react-app .


    Run the container:

    • docker run -d -p 3000:3000 react-app


    Open:

    • http://localhost:3000


    Your React application should now be accessible.

     

    Deploying a Node.js Application



    Create a Dockerfile:



    Build the image:

      
      FROM node:22
    
    WORKDIR /app
    
    COPY package*.json ./
    
    RUN npm install
    
    COPY . .
    
    EXPOSE 5000
    
    CMD ["node","server.js"]
      

    • docker build -t node-app .


    Run the application:

    • docker run -d -p 5000:5000 node-app


    Access:

    • http://localhost:5000

     

    Deploying React, Node.js, and MongoDB Together



    A production application often contains:



    Docker Compose makes managing these services much easier.

    Example:

     

    React Frontend
           │
           ▼
    Node.js Backend
           │
           ▼
    MongoDB Database
    

     

     
    Start everything:

    docker compose up -d

    Now all services run together.

     

    version: '3'
    
    services:
      frontend:
        image: react-app
        ports:
          - "3000:3000"
    
      backend:
        image: node-app
        ports:
          - "5000:5000"
    
      mongodb:
        image: mongo
        ports:
          - "27017:27017"
    

     

     

    Container Troubleshooting


    Troubleshooting is an essential Docker skill for System Engineers and DevOps Engineers.

    Check Running Container


    • docker ps


    View all containers:

    • docker ps -a 

     

     

    Check Container Logs


    Logs help identify startup issues.

    docker logs container_name

    Example:

    • docker logs backend


    Access Container Shell



    Enter a running container:

    • docker exec -it container_name bash


    Example:

    • docker exec -it backend bash


    This is useful for checking:

    • Application files
    • Environment variables
    • Network connectivity
    • Installed packages

     

     

    Inspect Container Details


    View container configuration:

    docker inspect container_name

    This displays:

    • IP Address
    • Volumes
    • Networks
    • Environment Variables
    • Mount Points
    • Monitor Resource Usage


    Check CPU and Memory:

    • docker stats


    Useful for identifying performance bottlenecks.

     

     Restart a Container


    docker restart container_name

    Example:

    • docker restart backend

     

    Common Docker Issues


    Port Already in Use

    Error:

    • Bind for 0.0.0.0 failed


    Solution:

    • docker ps


    Find the conflicting container and stop it.

     

    Container Exits Immediately



    Check logs:

    • docker logs container_name



    Usually caused by:

    • Incorrect CMD
    • Missing dependencies
    • Application errors
    • Cannot Access Application



    Verify:

    • docker ps



    Check:

    • Port mapping
    • Firewall settings
    • Container status 

     

    Network Communication Issues


    Inspect network:

    • docker network ls
    • Inspect container:
    • docker inspect container_name
    • Ensure containers are connected to the same Docker network.



    Essential Commands


    Start Compose:

    • docker compose up -d
    • Stop Compose:
    • docker compose down
    • View Containers:
    • docker ps
    • View Logs:
    • docker logs container_name
    • Enter Container:
    • docker exec -it container_name bash
    • Inspect Container:
    • docker inspect container_name
    • Monitor Resources:
    • docker stats

     


    Conclusion



    Docker Compose simplifies the management of multi-container applications by allowing developers and system administrators to define services in a single configuration file.

    Combined with React, Node.js, and MongoDB deployments, Docker Compose enables efficient application management and scalable infrastructure. Understanding container troubleshooting techniques further prepares you for real-world DevOps, Cloud Engineering, and System Administration roles.

    Mastering Docker Compose and troubleshooting skills is a significant step toward becoming a proficient System Engineer or DevOps Engineer.

     

     

  • WHAT WE DO

    We've been developing corporate tailored services for clients for 30 years.

    CONTACT US

    For enquiries you can contact us in several different ways. Contact details are below.

    Hacking Truth.in

    • Street :Road Street 00
    • Person :Person
    • Phone :+045 123 755 755
    • Country :POLAND
    • Email :contact@heaven.com

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.