Aditya
Aditya

Reputation: 1058

Location of bind-mount volume provided in docker-compose file of mongodb

How to see the location of bind-mount volume provided in the docker-compose yml file. I have created an bind-mount to persist the mongodb. It is working fine i.e. if container is shut, then also the data is present, but I want to know where is this location present in my computer.

version : "3"
services:
eswmongodb:
  image: mongo:latest
  container_name: mongocont
  ports:
    - "27017:27017"
  volumes:
    - "~/mongo/db:/data/db"

Upvotes: 0

Views: 927

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191874

if the container is shut, the data is present

There would be no way for you to know this unless you've already found it stored on the host.

The location is what you've given - ~/mongo/db. Open a terminal and cd to the path

Keep in mind that in Windows, ~ is a special character and is sometimes hidden in the file explorer. If you're using it to get to your User folder, you should prefer using environment variables instead https://superuser.com/questions/332871/what-is-the-equivalent-of-linuxs-tilde-in-windows

Upvotes: 2

Related Questions