I'm trying to mount a data volume to a docker container using the Rex-Ray plugin. I've chosen VirtualBox Media as the storage provider.

The versions I'm using are:

  • Docker 1.12.5
  • Rex-Ray 0.6.3 with libStorage 0.3.5
  • VirtualBox base package 5.1.12

The setup:

  • One CentOS 7 VM running in VirtualBox
  • Docker 1.12.5 running in the CentOS 7 VM
  • Rex-Ray installed and running in the CentOS 7 VM
  • Mac OS X 10.12.1 host machine

On the Mac OS host machine:

1 . I turn off VirtualBox SOAP API authentication with VBoxManage setproperty websrvauthlibrary null

2 . I start the VirtualBox SOAP API with vboxwebsrv -H 0.0.0.0 -v to allow Rex-Ray to communicate with VirtualBox

In the CentOS 7 VM I'm doing the following (as root):

1 . Start Docker with systemctl start docker

2 . Create the Rex-Ray /etc/rexray/config.yml file:

libstorage:
  service: virtualbox
  integration:
    volume:
      operations:
        mount:
          preempt: true
virtualbox:
  endpoint: http://192.168.99.1:18083
  volumePath: /Users/<username>/Volumes
  controllerName: SATA

where the endpoint is the IP on which the VirtualBox SOAP API runs on the Mac OS X host machine and volumePath is an existing folder on the Mac OS X host in which volumes will be stored after creation

This config file follows the same format found in the Dell EMC tutorial on https://github.com/codedellemc/labs/tree/master/setup-virtualbox-dockermachine

3 . Start Rex-Ray service using rexray start

4 . Create a 1GB volume with docker volume create -d rexray --name pg_data --opt=size=1

5 . Attempt to run a Postgres docker container using the official postgres image. The rexray volume created previously is mounted to the /var/lib/postgresql/data directory in the Postgres container:

docker run -dit --name pg -e POSTGRES_PASSWORD=mysecretpassword --volume-driver=rexray -v pg_data:/var/lib/postgresql/data postgres

The container fails to start and I receive the following error

Error response from daemon: VolumeDriver.Mount: {"Error":"VirtualBox error: Invalid managed object reference """}

My VirtualBox storage settings are shown in the following image:

virtualbox storage settings

Any help much appreciated

1

There are 1 answers

0
AmazingBergkamp On BEST ANSWER

The problem was that the port count for the SATA controller in the VirtualBox storage settings (as shown in the image linked in the question) is set to 1 by default.

The solution was to change this count to however many volumes you think you're going to mount.

A suggested count is 30 according to the Rex-Ray docs: http://rexray.readthedocs.io/en/v0.3.3/user-guide/storage-providers/#virtualbox

The following configuration worked for me:

image of VirtualBox storage setting