2

I am using and existing mongodb image to create a docker container. Then I create some databases and collections in that container. However, when I create and image from that container, mongodb does not show my databases and collections.

I guess its something to do with data volumes not copied over to image. Is there a workaround for this?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
kmakma
  • 73
  • 9

1 Answers1

1

Saving container (docker commit) with volumes is for now a closed (unresolved) issue (6999).
See also issue 7583, which points to PR 13987

Update the man page for 'docker commit' to make explicit the fact that 'commit' does not save data in volumes.

You would need to save your /var/lib/docker/volumes/<right_volume> yourself in order to restore its content in the new volume created by a mongodb image.
Its Dockerfile creates two of them.

VOLUME /data/db /data/configdb

I did in the past restored the content of deleted volume.
I now less need that with docker volume commands (but those volumes still cannot be committed as an image).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250