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:
The setup:
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:
Any help much appreciated
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: