# Docker Volume Simple Practical Example

### Step 1 : Create one directory.

mkdir app

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706218928/01708b80-f946-48cc-93be-427d1e445cd0.jpeg align="center")

### Step 2: Create one index.js file.

vim index.js

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706246680/56209436-8697-412a-bdd0-bb8d4be1035a.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706315244/51343c7a-cff3-4862-b44e-f637f75eae6b.jpeg align="center")

### Step 3: Pull the node image.

docker run -it node:latest

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706284301/f76b420d-9db2-4eec-981b-380fd9c5d5dc.jpeg align="center")

### Step 4: Check the container.

docker container ls -a

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706367487/6190a5c8-7a56-4fbc-a0ef-6c000e7caa75.jpeg align="center")

### Step 5: Check the working directory where you have created the app directory and copy the path.

pwd

### Step 6: Mount the container into the application. 

docker run -it -v /home/deepak/app:/home/app node bash

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706621069/6e661e90-ea9f-476f-b4e7-c650c4daad08.jpeg align="center")

/home/deepak/app :- This is the local machine path where the application directory is present.

/home/app :- This is the mount directory path, which means the mount container location.

node :- This is the image.

bash :- This is the bash terminal I want to open for the next command.

### Step 7: Checking the bash terminal is user

uname

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706659878/93d7c0e4-ef67-4f46-a83a-9adbe83e5bbc.jpeg align="center")

### Step 8: Checking if the home directory is present or not. 

ls

***Refer step 9 screenshot.***

### Step 9: Go to the home directory.

cd home

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706686987/d14216a8-1022-419a-aa7d-30547040765a.jpeg align="center")

### Step 10: Checking files under home directory

ls

app :- This is our directory.

node :- This is our image.

***Refer step 9 screenshot.***

### Step 11: Go into the app directory and check the index. js

cd app

cat index.js

(You will get the code of the index.js file.)

***Refer step 9 screenshot.***

### Step 12: Install Nodemon to run the index.js file.

npm install -g nodemon

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706872163/8cdf5ecf-8956-4977-bb24-8e14b5630bee.jpeg align="center")

### Step 13: Run the index.js application. 

nodemon index.js

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706951077/2cdd90eb-77f4-4b61-9666-bc5cb8b5b3ff.jpeg align="center")

### Step 14: Open another terminal, try to edit the local index.js file, and save. All changes will apply to the running environment.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1711706960635/f8586366-febf-4081-a77e-663ea51eef9d.jpeg align="center")

Happy Learning...!

Will come soon with another way to mount volume...!
