Skip to content
Araz Shah
Menu
  • Home
  • About me
  • Contact me
  • CV
  • Online Courses
    • Apply Now !
    • In-Depth
    • Courses
      • Concepts
      • Python Course
      • GIS Developer Course
      • Data Science with Python
    • Price
Menu
Header image
Free Pre-Registration

Docker volume to mount

Posted on September 8, 2023 by admin

The -v flag in Docker is used to specify a volume to mount into a Docker container. A volume in Docker is a way to share data between a container and the host machine, or between containers. This allows you to persist data, share files, or communicate between containers.

The basic syntax for using the -v flag is:

docker run -v <host_path>:<container_path> ...
  • <host_path> is the path to the directory or file on the host machine that you want to make available inside the container.
  • <container_path> is the path inside the container where you want to mount the volume.

Here’s an example:

Let’s say you have a simple Node.js application in a directory on your host machine, and you want to run it in a Docker container. You can use the -v flag to mount your local directory into the container, so any changes you make on your host will be reflected in the container, and vice versa.

docker run -v /path/to/your/app:/app my-node-app

In this example:

  • /path/to/your/app is the path on your host machine where your Node.js application code resides.
  • /app is the path inside the container where you want to mount the volume.
  • my-node-app is the name of the Docker image you want to run.

Now, any changes you make to the code in /path/to/your/app on your host machine will be immediately visible inside the running Docker container at /app. This is useful for development and debugging purposes.

You can also use named volumes for more advanced use cases and data persistence in Docker. The -v flag is a powerful feature that enables data sharing and persistence between containers and the host.

Category: programming, Tutorials

Post navigation

← Running RabbitMQ on Docker
list of containers is not displayed →

Recent Posts

  • Instructions for Joining the Free First Session of the “Data Science with Python” Course
  • Data Science with Python – Live, Project-Based Online Course
  • Unlocking Insights: How Geospatial Reasoning Revolutionizes Data Analysis with AI
  • Geospatial Risk Assessment: A Python Approach
  • Analyzing Employee Arrival Patterns and Delays Using Geospatial Data

Archives

  • August 2025
  • May 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • September 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • September 2023
  • August 2023
  • April 2023

Categories

  • Courses
  • Events
  • GIS
  • Linux
  • News
  • programming
  • python
  • Tutorials
  • Videos
  • August 2025
  • May 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • September 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • September 2023
  • August 2023
  • April 2023
  • Courses
  • Events
  • GIS
  • Linux
  • News
  • programming
  • python
  • Tutorials
  • Videos

Araz Shahkarami

I’m a software enthusiast with a deep love for crafting robust and efficient solutions. My journey into the world of programming began several years ago when I was introduced to the world of code. Since then, I’ve been on an exhilarating ride of learning, problem-solving, and continuous improvement.

© 2025 Araz Shah | Powered by Minimalist Blog WordPress Theme