Docker compose generates anonymous volume rather then existing named volumeHow docker volume container (mounted a host directory ) used in compose file version 2Docker-compose named mounted volumedocker-compose does not update resolv.confSaving mongodb on volume using docker-composeUsing environment variable for volume name in docker composeDocker compose reusing volumesCan't connect to MongoDB container from other Docker containerHow to add a volume from a diferent server to my docker-compose fileMax MongoDB Connections when running with docker-composeHow to manage multiple docker files and docker-compose for local and prod setups?

Pristine Bit Checking

I see my dog run

Symmetry in quantum mechanics

Does a dangling wire really electrocute me if I'm standing in water?

Why airport relocation isn't done gradually?

What do the Banks children have against barley water?

Does it makes sense to buy a new cycle to learn riding?

Is "plugging out" electronic devices an American expression?

Shall I use personal or official e-mail account when registering to external websites for work purpose?

How to make payment on the internet without leaving a money trail?

Is domain driven design an anti-SQL pattern?

Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?

Re-submission of rejected manuscript without informing co-authors

How would photo IDs work for shapeshifters?

What does 'script /dev/null' do?

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Does the average primeness of natural numbers tend to zero?

Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?

"listening to me about as much as you're listening to this pole here"

Is this food a bread or a loaf?

aging parents with no investments

Email Account under attack (really) - anything I can do?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

What happens when a metallic dragon and a chromatic dragon mate?



Docker compose generates anonymous volume rather then existing named volume


How docker volume container (mounted a host directory ) used in compose file version 2Docker-compose named mounted volumedocker-compose does not update resolv.confSaving mongodb on volume using docker-composeUsing environment variable for volume name in docker composeDocker compose reusing volumesCan't connect to MongoDB container from other Docker containerHow to add a volume from a diferent server to my docker-compose fileMax MongoDB Connections when running with docker-composeHow to manage multiple docker files and docker-compose for local and prod setups?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















In order to keep track of the volumes used, i like to use named volumes. Currently i have one named volume



docker volume ls
DRIVER VOLUME NAME
local mongodb


my docker-compose file is something like this:



version: "3"

services:
db:
image: mongo:4.0.6
container_name: mongo
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: macmongoroot
volumes:
- mongodb:/data/db

volumes:
mongodb:
external:
name: mongodb

networks:
default:
external:
name: macbook


everytime i run docker-compose docker-compose up -d docker compose adds a new anonymous volume rather then using the named one :



docker volume ls
DRIVER VOLUME NAME
local a4a02fffa9bbbdd11c76359264a5bf24614943c5b1b0070b33a84e51266c58d7
local mongodb


this docker compose file works fine on my server but on my docker desktop i'm having this issue. currently using Docker Desktop version 2.0.0.3 (31259). Any help would be appreciated thanks










share|improve this question






















  • what are the versions of your docker-compose programs? (docker-compose version)

    – Thomasleveil
    Mar 8 at 7:57











  • @Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

    – HelloMyNameIs
    Mar 8 at 8:01











  • are those the versions found on your server or desktop? Are the same version on the server and desktop?

    – Thomasleveil
    Mar 8 at 9:09











  • @Thomasleveil on my desktop. no the server version are bit more older

    – HelloMyNameIs
    Mar 8 at 11:44

















0















In order to keep track of the volumes used, i like to use named volumes. Currently i have one named volume



docker volume ls
DRIVER VOLUME NAME
local mongodb


my docker-compose file is something like this:



version: "3"

services:
db:
image: mongo:4.0.6
container_name: mongo
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: macmongoroot
volumes:
- mongodb:/data/db

volumes:
mongodb:
external:
name: mongodb

networks:
default:
external:
name: macbook


everytime i run docker-compose docker-compose up -d docker compose adds a new anonymous volume rather then using the named one :



docker volume ls
DRIVER VOLUME NAME
local a4a02fffa9bbbdd11c76359264a5bf24614943c5b1b0070b33a84e51266c58d7
local mongodb


this docker compose file works fine on my server but on my docker desktop i'm having this issue. currently using Docker Desktop version 2.0.0.3 (31259). Any help would be appreciated thanks










share|improve this question






















  • what are the versions of your docker-compose programs? (docker-compose version)

    – Thomasleveil
    Mar 8 at 7:57











  • @Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

    – HelloMyNameIs
    Mar 8 at 8:01











  • are those the versions found on your server or desktop? Are the same version on the server and desktop?

    – Thomasleveil
    Mar 8 at 9:09











  • @Thomasleveil on my desktop. no the server version are bit more older

    – HelloMyNameIs
    Mar 8 at 11:44













0












0








0








In order to keep track of the volumes used, i like to use named volumes. Currently i have one named volume



docker volume ls
DRIVER VOLUME NAME
local mongodb


my docker-compose file is something like this:



version: "3"

services:
db:
image: mongo:4.0.6
container_name: mongo
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: macmongoroot
volumes:
- mongodb:/data/db

volumes:
mongodb:
external:
name: mongodb

networks:
default:
external:
name: macbook


everytime i run docker-compose docker-compose up -d docker compose adds a new anonymous volume rather then using the named one :



docker volume ls
DRIVER VOLUME NAME
local a4a02fffa9bbbdd11c76359264a5bf24614943c5b1b0070b33a84e51266c58d7
local mongodb


this docker compose file works fine on my server but on my docker desktop i'm having this issue. currently using Docker Desktop version 2.0.0.3 (31259). Any help would be appreciated thanks










share|improve this question














In order to keep track of the volumes used, i like to use named volumes. Currently i have one named volume



docker volume ls
DRIVER VOLUME NAME
local mongodb


my docker-compose file is something like this:



version: "3"

services:
db:
image: mongo:4.0.6
container_name: mongo
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: macmongoroot
volumes:
- mongodb:/data/db

volumes:
mongodb:
external:
name: mongodb

networks:
default:
external:
name: macbook


everytime i run docker-compose docker-compose up -d docker compose adds a new anonymous volume rather then using the named one :



docker volume ls
DRIVER VOLUME NAME
local a4a02fffa9bbbdd11c76359264a5bf24614943c5b1b0070b33a84e51266c58d7
local mongodb


this docker compose file works fine on my server but on my docker desktop i'm having this issue. currently using Docker Desktop version 2.0.0.3 (31259). Any help would be appreciated thanks







docker docker-compose docker-machine docker-desktop






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 7:24









HelloMyNameIsHelloMyNameIs

62




62












  • what are the versions of your docker-compose programs? (docker-compose version)

    – Thomasleveil
    Mar 8 at 7:57











  • @Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

    – HelloMyNameIs
    Mar 8 at 8:01











  • are those the versions found on your server or desktop? Are the same version on the server and desktop?

    – Thomasleveil
    Mar 8 at 9:09











  • @Thomasleveil on my desktop. no the server version are bit more older

    – HelloMyNameIs
    Mar 8 at 11:44

















  • what are the versions of your docker-compose programs? (docker-compose version)

    – Thomasleveil
    Mar 8 at 7:57











  • @Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

    – HelloMyNameIs
    Mar 8 at 8:01











  • are those the versions found on your server or desktop? Are the same version on the server and desktop?

    – Thomasleveil
    Mar 8 at 9:09











  • @Thomasleveil on my desktop. no the server version are bit more older

    – HelloMyNameIs
    Mar 8 at 11:44
















what are the versions of your docker-compose programs? (docker-compose version)

– Thomasleveil
Mar 8 at 7:57





what are the versions of your docker-compose programs? (docker-compose version)

– Thomasleveil
Mar 8 at 7:57













@Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

– HelloMyNameIs
Mar 8 at 8:01





@Thomasleveil i'm currently using docker-compose v 1.23.2, docker-machine v 0.16.1 and docker engine v 18.09.2

– HelloMyNameIs
Mar 8 at 8:01













are those the versions found on your server or desktop? Are the same version on the server and desktop?

– Thomasleveil
Mar 8 at 9:09





are those the versions found on your server or desktop? Are the same version on the server and desktop?

– Thomasleveil
Mar 8 at 9:09













@Thomasleveil on my desktop. no the server version are bit more older

– HelloMyNameIs
Mar 8 at 11:44





@Thomasleveil on my desktop. no the server version are bit more older

– HelloMyNameIs
Mar 8 at 11:44












1 Answer
1






active

oldest

votes


















0














The anonymous volume belongs to /data/configdb which in the Dockerfile instructions



VOLUME /data/db /data/configdb


By doing docker inspect on the created container you will notice the following:



"Mounts": [

"Type": "volume",
"Name": "mongodb",
"Source": "/var/lib/docker/volumes/mongodb/_data",
"Destination": "/data/db",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
,

"Type": "volume",
"Name": "be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6",
"Source": "/var/lib/docker/volumes/be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6/_data",
"Destination": "/data/configdb",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

]


Which means that mongodb volume is actually being used for the data as you asked however another volume will be created for this /data/configdb. Also you can verify that the data exist by checking this source path /var/lib/docker/volumes/mongodb/_data where mongodb data will be saved



$ ls /var/lib/docker/volumes/mongodb/_data total 328
drwxr-xr-x 4 999 999 4096 Mar 8 11:02 .
drwxr-xr-x 3 root root 4096 Mar 8 10:58 ..
-rw------- 1 999 999 16384 Mar 8 11:00 collection-0--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 collection-2--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:00 collection-4--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 11:00 collection-7--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:11 diagnostic.data
-rw------- 1 999 999 16384 Mar 8 11:00 index-1--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 index-3--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 10:58 index-5--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:01 index-6--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-8--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-9--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:00 journal
-rw------- 1 999 999 16384 Mar 8 11:00 _mdb_catalog.wt
-rw------- 1 999 999 2 Mar 8 11:00 mongod.lock
-rw------- 1 999 999 36864 Mar 8 11:02 sizeStorer.wt
-rw------- 1 999 999 114 Mar 8 10:58 storage.bson
-rw------- 1 999 999 45 Mar 8 10:58 WiredTiger
-rw------- 1 999 999 4096 Mar 8 11:00 WiredTigerLAS.wt
-rw------- 1 999 999 21 Mar 8 10:58 WiredTiger.lock
-rw------- 1 999 999 1065 Mar 8 11:02 WiredTiger.turtle
-rw------- 1 999 999 69632 Mar 8 11:02 WiredTiger.wt





share|improve this answer

























  • thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

    – HelloMyNameIs
    Mar 8 at 12:59











  • The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

    – Mostafa Hussein
    Mar 8 at 13:07











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058533%2fdocker-compose-generates-anonymous-volume-rather-then-existing-named-volume%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The anonymous volume belongs to /data/configdb which in the Dockerfile instructions



VOLUME /data/db /data/configdb


By doing docker inspect on the created container you will notice the following:



"Mounts": [

"Type": "volume",
"Name": "mongodb",
"Source": "/var/lib/docker/volumes/mongodb/_data",
"Destination": "/data/db",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
,

"Type": "volume",
"Name": "be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6",
"Source": "/var/lib/docker/volumes/be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6/_data",
"Destination": "/data/configdb",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

]


Which means that mongodb volume is actually being used for the data as you asked however another volume will be created for this /data/configdb. Also you can verify that the data exist by checking this source path /var/lib/docker/volumes/mongodb/_data where mongodb data will be saved



$ ls /var/lib/docker/volumes/mongodb/_data total 328
drwxr-xr-x 4 999 999 4096 Mar 8 11:02 .
drwxr-xr-x 3 root root 4096 Mar 8 10:58 ..
-rw------- 1 999 999 16384 Mar 8 11:00 collection-0--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 collection-2--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:00 collection-4--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 11:00 collection-7--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:11 diagnostic.data
-rw------- 1 999 999 16384 Mar 8 11:00 index-1--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 index-3--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 10:58 index-5--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:01 index-6--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-8--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-9--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:00 journal
-rw------- 1 999 999 16384 Mar 8 11:00 _mdb_catalog.wt
-rw------- 1 999 999 2 Mar 8 11:00 mongod.lock
-rw------- 1 999 999 36864 Mar 8 11:02 sizeStorer.wt
-rw------- 1 999 999 114 Mar 8 10:58 storage.bson
-rw------- 1 999 999 45 Mar 8 10:58 WiredTiger
-rw------- 1 999 999 4096 Mar 8 11:00 WiredTigerLAS.wt
-rw------- 1 999 999 21 Mar 8 10:58 WiredTiger.lock
-rw------- 1 999 999 1065 Mar 8 11:02 WiredTiger.turtle
-rw------- 1 999 999 69632 Mar 8 11:02 WiredTiger.wt





share|improve this answer

























  • thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

    – HelloMyNameIs
    Mar 8 at 12:59











  • The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

    – Mostafa Hussein
    Mar 8 at 13:07















0














The anonymous volume belongs to /data/configdb which in the Dockerfile instructions



VOLUME /data/db /data/configdb


By doing docker inspect on the created container you will notice the following:



"Mounts": [

"Type": "volume",
"Name": "mongodb",
"Source": "/var/lib/docker/volumes/mongodb/_data",
"Destination": "/data/db",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
,

"Type": "volume",
"Name": "be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6",
"Source": "/var/lib/docker/volumes/be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6/_data",
"Destination": "/data/configdb",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

]


Which means that mongodb volume is actually being used for the data as you asked however another volume will be created for this /data/configdb. Also you can verify that the data exist by checking this source path /var/lib/docker/volumes/mongodb/_data where mongodb data will be saved



$ ls /var/lib/docker/volumes/mongodb/_data total 328
drwxr-xr-x 4 999 999 4096 Mar 8 11:02 .
drwxr-xr-x 3 root root 4096 Mar 8 10:58 ..
-rw------- 1 999 999 16384 Mar 8 11:00 collection-0--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 collection-2--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:00 collection-4--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 11:00 collection-7--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:11 diagnostic.data
-rw------- 1 999 999 16384 Mar 8 11:00 index-1--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 index-3--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 10:58 index-5--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:01 index-6--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-8--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-9--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:00 journal
-rw------- 1 999 999 16384 Mar 8 11:00 _mdb_catalog.wt
-rw------- 1 999 999 2 Mar 8 11:00 mongod.lock
-rw------- 1 999 999 36864 Mar 8 11:02 sizeStorer.wt
-rw------- 1 999 999 114 Mar 8 10:58 storage.bson
-rw------- 1 999 999 45 Mar 8 10:58 WiredTiger
-rw------- 1 999 999 4096 Mar 8 11:00 WiredTigerLAS.wt
-rw------- 1 999 999 21 Mar 8 10:58 WiredTiger.lock
-rw------- 1 999 999 1065 Mar 8 11:02 WiredTiger.turtle
-rw------- 1 999 999 69632 Mar 8 11:02 WiredTiger.wt





share|improve this answer

























  • thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

    – HelloMyNameIs
    Mar 8 at 12:59











  • The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

    – Mostafa Hussein
    Mar 8 at 13:07













0












0








0







The anonymous volume belongs to /data/configdb which in the Dockerfile instructions



VOLUME /data/db /data/configdb


By doing docker inspect on the created container you will notice the following:



"Mounts": [

"Type": "volume",
"Name": "mongodb",
"Source": "/var/lib/docker/volumes/mongodb/_data",
"Destination": "/data/db",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
,

"Type": "volume",
"Name": "be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6",
"Source": "/var/lib/docker/volumes/be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6/_data",
"Destination": "/data/configdb",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

]


Which means that mongodb volume is actually being used for the data as you asked however another volume will be created for this /data/configdb. Also you can verify that the data exist by checking this source path /var/lib/docker/volumes/mongodb/_data where mongodb data will be saved



$ ls /var/lib/docker/volumes/mongodb/_data total 328
drwxr-xr-x 4 999 999 4096 Mar 8 11:02 .
drwxr-xr-x 3 root root 4096 Mar 8 10:58 ..
-rw------- 1 999 999 16384 Mar 8 11:00 collection-0--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 collection-2--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:00 collection-4--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 11:00 collection-7--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:11 diagnostic.data
-rw------- 1 999 999 16384 Mar 8 11:00 index-1--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 index-3--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 10:58 index-5--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:01 index-6--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-8--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-9--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:00 journal
-rw------- 1 999 999 16384 Mar 8 11:00 _mdb_catalog.wt
-rw------- 1 999 999 2 Mar 8 11:00 mongod.lock
-rw------- 1 999 999 36864 Mar 8 11:02 sizeStorer.wt
-rw------- 1 999 999 114 Mar 8 10:58 storage.bson
-rw------- 1 999 999 45 Mar 8 10:58 WiredTiger
-rw------- 1 999 999 4096 Mar 8 11:00 WiredTigerLAS.wt
-rw------- 1 999 999 21 Mar 8 10:58 WiredTiger.lock
-rw------- 1 999 999 1065 Mar 8 11:02 WiredTiger.turtle
-rw------- 1 999 999 69632 Mar 8 11:02 WiredTiger.wt





share|improve this answer















The anonymous volume belongs to /data/configdb which in the Dockerfile instructions



VOLUME /data/db /data/configdb


By doing docker inspect on the created container you will notice the following:



"Mounts": [

"Type": "volume",
"Name": "mongodb",
"Source": "/var/lib/docker/volumes/mongodb/_data",
"Destination": "/data/db",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
,

"Type": "volume",
"Name": "be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6",
"Source": "/var/lib/docker/volumes/be86274b1f6009eb60b8acb3855f51931c4ccc7df700666555422396688b0dd6/_data",
"Destination": "/data/configdb",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""

]


Which means that mongodb volume is actually being used for the data as you asked however another volume will be created for this /data/configdb. Also you can verify that the data exist by checking this source path /var/lib/docker/volumes/mongodb/_data where mongodb data will be saved



$ ls /var/lib/docker/volumes/mongodb/_data total 328
drwxr-xr-x 4 999 999 4096 Mar 8 11:02 .
drwxr-xr-x 3 root root 4096 Mar 8 10:58 ..
-rw------- 1 999 999 16384 Mar 8 11:00 collection-0--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 collection-2--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:00 collection-4--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 11:00 collection-7--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:11 diagnostic.data
-rw------- 1 999 999 16384 Mar 8 11:00 index-1--2358474299739251284.wt
-rw------- 1 999 999 36864 Mar 8 11:01 index-3--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 10:58 index-5--2358474299739251284.wt
-rw------- 1 999 999 4096 Mar 8 11:01 index-6--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-8--2358474299739251284.wt
-rw------- 1 999 999 16384 Mar 8 10:58 index-9--2358474299739251284.wt
drwx------ 2 999 999 4096 Mar 8 11:00 journal
-rw------- 1 999 999 16384 Mar 8 11:00 _mdb_catalog.wt
-rw------- 1 999 999 2 Mar 8 11:00 mongod.lock
-rw------- 1 999 999 36864 Mar 8 11:02 sizeStorer.wt
-rw------- 1 999 999 114 Mar 8 10:58 storage.bson
-rw------- 1 999 999 45 Mar 8 10:58 WiredTiger
-rw------- 1 999 999 4096 Mar 8 11:00 WiredTigerLAS.wt
-rw------- 1 999 999 21 Mar 8 10:58 WiredTiger.lock
-rw------- 1 999 999 1065 Mar 8 11:02 WiredTiger.turtle
-rw------- 1 999 999 69632 Mar 8 11:02 WiredTiger.wt






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 8 at 9:12

























answered Mar 8 at 9:06









Mostafa HusseinMostafa Hussein

5,12731338




5,12731338












  • thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

    – HelloMyNameIs
    Mar 8 at 12:59











  • The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

    – Mostafa Hussein
    Mar 8 at 13:07

















  • thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

    – HelloMyNameIs
    Mar 8 at 12:59











  • The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

    – Mostafa Hussein
    Mar 8 at 13:07
















thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

– HelloMyNameIs
Mar 8 at 12:59





thanks that cleared why there's another volume, but my issue still remains that every time i do a docker-compose down then do a docker-compose up -d seems like all my mongodb data is removed. later i'l try to do docker inspect and have it posted here.

– HelloMyNameIs
Mar 8 at 12:59













The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

– Mostafa Hussein
Mar 8 at 13:07





The data wont be removed because they are on an external volume. I have tested it and I still have the old data exist

– Mostafa Hussein
Mar 8 at 13:07



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058533%2fdocker-compose-generates-anonymous-volume-rather-then-existing-named-volume%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко