<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: jazzybruno</title>
    <description>The latest articles on Forem by jazzybruno (@jazzybruno).</description>
    <link>https://forem.com/jazzybruno</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F822845%2F174c40cc-b716-4389-a7ae-e4859f5ebb7c.jpeg</url>
      <title>Forem: jazzybruno</title>
      <link>https://forem.com/jazzybruno</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jazzybruno"/>
    <language>en</language>
    <item>
      <title>Understanding Volume Mounting in Docker</title>
      <dc:creator>jazzybruno</dc:creator>
      <pubDate>Sat, 06 Jan 2024 19:46:59 +0000</pubDate>
      <link>https://forem.com/jazzybruno/understanding-volume-mounting-in-docker-1ip0</link>
      <guid>https://forem.com/jazzybruno/understanding-volume-mounting-in-docker-1ip0</guid>
      <description>&lt;p&gt;Docker volumes play a crucial role in persistently storing and managing data for containerized applications. They provide a mechanism for sharing data between containers, as well as between containers and the host machine. In this blog post, we'll explore the fundamentals of volume mounting in Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What are Docker Volumes?
&lt;/h2&gt;

&lt;p&gt;In Docker, a volume is a named filesystem mount that exists outside of any container. It acts as a persistent data storage solution, allowing containers to store and access data even after they are stopped or removed. Docker supports various types of volumes, including local volumes, named volumes, and anonymous volumes.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Creating Docker Volumes
&lt;/h2&gt;

&lt;p&gt;Creating a Docker volume is a straightforward process. You can use the docker volume create command and provide a name for the volume. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume create my_volume

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a named volume called &lt;strong&gt;my_volume&lt;/strong&gt;, which can be used to store and share data between containers&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Mounting Volumes in Containers
&lt;/h2&gt;

&lt;p&gt;To use a volume in a Docker container, you can use the -v or --volume option when running the container. The basic syntax is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -v &amp;lt;volume_name_or_path_on_host&amp;gt;:&amp;lt;path_in_container&amp;gt; ...

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For instance, to mount the &lt;strong&gt;my_volume *&lt;em&gt;volume into the *&lt;/em&gt;/app/data&lt;/strong&gt; directory in the container, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -v my_volume:/app/data my_image

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows the container to access and modify data within the my_volume volume.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Docker Compose and Volumes
&lt;/h2&gt;

&lt;p&gt;Docker Compose simplifies the management of volumes in multi-container environments. You can define volumes directly in a &lt;strong&gt;docker-compose.yml&lt;/strong&gt; file. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3'
services:
  my_service:
    image: my_image
    volumes:
      - my_volume:/app/data
volumes:
  my_volume:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Docker Compose configuration creates a named volume named my_volume and mounts it into the /app/data directory of the my_service container.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Persistent Storage and Data Sharing
&lt;/h2&gt;

&lt;p&gt;One of the primary benefits of using volumes is achieving persistent storage for Docker containers. Data stored in a volume persists even when the container is stopped or removed. Additionally, volumes facilitate data sharing between containers, allowing multiple containers to access and modify shared data.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Lifecycle of Docker Volumes
&lt;/h2&gt;

&lt;p&gt;It's important to note that Docker volumes have an independent lifecycle. They need to be created, managed, and deleted separately from containers. Removing a container does not automatically remove its associated volumes.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Checking Volume Information
&lt;/h2&gt;

&lt;p&gt;You can inspect volume information using the &lt;strong&gt;docker volume inspect&lt;/strong&gt; command. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume inspect my_volume

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command provides detailed information about the specified volume, including its name, mountpoint, and driver.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Cleaning Up Volumes
&lt;/h2&gt;

&lt;p&gt;To remove a volume, you can use the docker volume rm command. For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume rm my_volume

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command removes the my_volume volume, freeing up storage space on the host machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Using Volumes for Application Data
&lt;/h2&gt;

&lt;p&gt;Volumes are commonly used for storing application data, configuration files, and databases. They provide a convenient way to separate data from the container, making it easier to manage, backup, and scale containerized applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Spring Boot Project Folder Structure</title>
      <dc:creator>jazzybruno</dc:creator>
      <pubDate>Tue, 04 Jul 2023 08:02:51 +0000</pubDate>
      <link>https://forem.com/jazzybruno/spring-boot-project-folder-structure-12oe</link>
      <guid>https://forem.com/jazzybruno/spring-boot-project-folder-structure-12oe</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvvyfr6hpex8hwjh1tbv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvvyfr6hpex8hwjh1tbv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spring Boot&lt;/strong&gt; is an open-source Java-based framework that simplifies the development of standalone, production-grade applications. It is part of the larger Spring ecosystem, which provides a comprehensive framework for building enterprise-level Java applications.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;The Folder in the spring boot project are as follows *&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Config&lt;/li&gt;
&lt;li&gt; Controllers &lt;/li&gt;
&lt;li&gt; Enums&lt;/li&gt;
&lt;li&gt; Models&lt;/li&gt;
&lt;li&gt; POJO / DTOs&lt;/li&gt;
&lt;li&gt; Repositories&lt;/li&gt;
&lt;li&gt; Security&lt;/li&gt;
&lt;li&gt; Services&lt;/li&gt;
&lt;li&gt; Service Implementors &lt;/li&gt;
&lt;li&gt; Utils&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;config&lt;/strong&gt;: The "config" folder holds configuration files for customizing the application's behavior, such as application properties or YAML files, allowing developers to specify settings like server ports, database connections, and logging configurations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;controllers&lt;/strong&gt;: The "controllers" folder contains classes responsible for handling incoming HTTP requests, defining RESTful endpoints, and processing data. Controllers receive requests, interact with services, and return appropriate responses to the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enums&lt;/strong&gt;: The "Enums" folder holds enumerations, which are used to represent a fixed set of constant values in the application. Enums provide a convenient way to define and work with predefined options, such as status codes, types, or categories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;models&lt;/strong&gt;: The "models" folder stores the data models or entities that represent the structure and behavior of the application's domain. These classes typically map to database tables or external data sources and define the properties and relationships of the application's data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POJO / DTOs&lt;/strong&gt;: The "POJO" or "DTOs" (Data Transfer Objects) folder contains classes that serve as plain old Java objects or data transfer objects used for transferring data between layers of the application. They encapsulate data and provide a standardized format for communication between different components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repositories&lt;/strong&gt;: The "Repositories" folder contains classes responsible for data access and persistence. These classes interact with the underlying database or data store, providing methods for querying, saving, updating, and deleting data. Repositories often use Spring Data JPA or other persistence frameworks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: The "Security" folder holds classes related to application security, including configuration for authentication and authorization. It may contain components such as security configurations, authentication providers, access control rules, and custom security-related classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Services&lt;/strong&gt;: The "Services" folder contains classes that encapsulate the business logic of the application. Services provide a layer of abstraction between the controllers and repositories, handling complex operations, processing data, and enforcing business rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service Implementors&lt;/strong&gt;: The "Service Implementors" folder holds classes that implement the interfaces defined in the services' folder. These classes contain the actual implementation of the business logic and interact with repositories and other components to fulfill the functionality defined by the services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Utils&lt;/strong&gt; : The "utils" folder in a Spring Boot application holds utility classes or helper functions providing reusable functionality across the application. These classes offer common tasks like data conversion, string manipulation, file handling, and more. They promote code organization, reduce duplication, and facilitate accessing and utilizing shared functionality. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpf5edxwfdun82gf2vj8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpf5edxwfdun82gf2vj8b.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxf6r8zg42fzzrw14mtl9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxf6r8zg42fzzrw14mtl9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>webdev</category>
      <category>api</category>
      <category>springboot</category>
    </item>
  </channel>
</rss>
