Search code examples
dockercontainersibm-cloud

How do you add a volume to a container in the IBM Bluemix Docker cloud?


How can you add a data volume to a container ? What is the best practice for services with persistent data in Bluemix ?


Solution

  • You can use:

     cf ic volume create VOLNAME
    

    to create a volume and

     cf ic run [IP_address] [-p
     PORT] [-P] [-m MEMORY] [-e ENV] [-v
     VolumeId:ContainerPath[:ro]] [--name NAME] [--link
     NAME:ALIAS] IMAGE [CMD
     [CMD ...]]
    
    • VolumeId:ContainerPath[:ro], (Optional) Attach a volume to a container by specifying the details in the following format
    • VolumeId: The volume ID or name.
    • ContainerPath: The absolute path to the volume in the container.
    • ro: Optional. Specifying ro makes the volume read-only instead of the default read/write.

    to attach a volume to a container

    More info here: https://www.ng.bluemix.net/docs/containers/doc/container_creating_ov.html#container_creating_ov
    and here: https://www.ng.bluemix.net/docs/containers/doc/container_optional.html

    Regards.