Skip to content

MD Express: Anonymous Volumes #157

@bluna301

Description

@bluna301

After composing up MONAI Deploy Express v0.6.1, there are two anonymous volumes that are created - one associated with the mdl-rabbitmq container, and the other associated with the mdl-mongodb container:

(deploy) bluna301:~/monai-deploy-express$ docker volume ls
DRIVER    VOLUME NAME
local     0f1d57f8e932181abe23d7847d7f2330892871c4fc3ce07b3582c21cdb2e039b
local     9845f01d6a4d128c57743874026381c8c051fe26d9cdab6af2b2e7c29e34c8f1

## 

(deploy) bluna301:~/monai-deploy-express$ docker ps -a --filter volume=0f1d57f8e932181abe23d7847d7f2330892871c4fc3ce07b3582c21cdb2e039b
CONTAINER ID   IMAGE                        COMMAND                  CREATED         STATUS                   PORTS                                                                                                         NAMES
9e8186b86aaa   rabbitmq:3.12.7-management   "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes (healthy)   4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   mdl-rabbitmq

##

(deploy) bluna301:~/monai-deploy-express$ docker ps -a --filter volume=9845f01d6a4d128c57743874026381c8c051fe26d9cdab6af2b2e7c29e34c8f1
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                   PORTS                      NAMES
890c5fb27dbb   mongo:5.0.25   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes (healthy)   0.0.0.0:27017->27017/tcp   mdl-mongodb

Investigating the mounts for the mdl-rabbitmq and mdl-mongodb containers (docker inspect {container_name}, Mounts section):

# mdl-rabbitmq:
"Mounts": [
    {
        "Type": "bind",
        "Source": "/home/bluna301/monai-deploy-express/.md/rabbitmq",
        "Destination": "/var/lib/rabbitmq/mnesia",
        "Mode": "rw",
        "RW": true,
        "Propagation": "rprivate"
    },
    {
        "Type": "volume",
        "Name": "0f1d57f8e932181abe23d7847d7f2330892871c4fc3ce07b3582c21cdb2e039b",
        "Source": "/var/lib/docker/volumes/0f1d57f8e932181abe23d7847d7f2330892871c4fc3ce07b3582c21cdb2e039b/_data",
        "Destination": "/var/lib/rabbitmq",
        "Driver": "local",
        "Mode": "",
        "RW": true,
        "Propagation": ""
    }
]

# mdl-mongodb:
"Mounts": [
    {
        "Type": "bind",
        "Source": "/home/bluna301/monai-deploy-express/.md/mongodb",
        "Destination": "/data/db",
        "Mode": "rw",
        "RW": true,
        "Propagation": "rprivate"
    },
    {
        "Type": "volume",
        "Name": "9845f01d6a4d128c57743874026381c8c051fe26d9cdab6af2b2e7c29e34c8f1",
        "Source": "/var/lib/docker/volumes/9845f01d6a4d128c57743874026381c8c051fe26d9cdab6af2b2e7c29e34c8f1/_data",
        "Destination": "/data/configdb",
        "Driver": "local",
        "Mode": "",
        "RW": true,
        "Propagation": ""
    }
]

The bind mounts are as defined in the docker-compose.yaml file; I believe the anonymous volumes are being created because the RabbitMQ and MongoDB Docker images (rabbitmq:3.12.7-management and mongo:5.0.25, respectively) have the following in their Dockerfiles:

# rabbitmq
VOLUME [/var/lib/rabbitmq]

# mongodb
VOLUME [/data/db /data/configdb]

The /data/db MongoDB bind mount is accounted for in the docker-compose.yaml, however the other two paths are not, and thus Docker creates anonymous volumes for them when the services are composed up.

@mocsharp is there a specific design consideration behind the existence of these two anonymous volumes? If not, I wonder what you think about converting these to bind mounts instead to match the behavior of the rest of the Docker volumes in the docker-compose.yaml and to not pollute Docker's Volumes section (docker compose down -v would obviously handle volume removal, but if anonymous volumes aren't necessary, making a change may be beneficial). If you agree with this conversion, my suggestion would be:

  • Adding a new MongoDB bind mount volume ($MONGODB_CONFIGDB:/data/configdb)
  • Changing the RabbitMQ bind mount volume ($RABBITMQ_DATA:/var/lib/rabbitmq/mnesia --> $RABBITMQ_DATA:/var/lib/rabbitmq

Happy to discuss further - thank you for your time!

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions