docker-phpvirtualbox icon indicating copy to clipboard operation
docker-phpvirtualbox copied to clipboard

Support advanced options

Open clue opened this issue 11 years ago • 1 comments

For example:

var $servers = array(
    array(
        'name' => 'London',
        'username' => 'vbox',
        'password' => 'secret1',
        'location' => 'http://10.32.32.4:18083/',
                'consoleHost' => '10.32.32.4',
                'noPreview' => true,
                'browserRestrictFolders' => array('/home/vbox','/mnt/media')

    ),

http://sourceforge.net/p/phpvirtualbox/wiki/Multiple%20Server%20Configuration/

clue avatar Oct 16 '14 12:10 clue

I ran into this problem trying to connect from phpvirtualbox to vboxweb-service running on the docker host (since my vbox user and password were not the defaults.) Here's my (slightly hacky) fix, and my complete setup in case anyone else is interested in doing this:

Setup:

  • Start with Ubuntu v14.04.2

  • Create/edit /etc/default/docker:

    DOCKER_OPTS="--bip 172.17.42.1/24"
    

    This will set up the docker bridge to always be on 172.17.42.1, which means from inside a docker container we can connect to 172.17.42.1 to get to the docker host.

  • Install virtualbox via apt

  • Create a 'vbox' user and set a password. Create a home directory for vbox.

  • Create /etc/default/virtualbox

    VBOXWEB_USER=vbox
    VBOXWEB_HOST=172.17.42.1
    
  • sudo service vboxweb-service start to get vboxweb-service up and running.

  • Create /opt/phpvirtualbox/config-servers.php

    <?php return array (
      0 =>
      array (
        'name' => 'galactica',
        'username' => 'vbox',
        'password' => 'password_you_created_for_vbox_goes_here',
        'authMaster' => true,
        'location' => 'http://172.17.42.1:18083/',
        'consoleHost' => '172.17.42.1',
      ),
    );
    
  • Run clue/phpvirtualbox with:

    docker run -d --name phpvirtualbox --restart=always \
    -p 8080:80 \
    -v /opt/phpvirtualbox/config-servers.php:/var/www/config-servers.php:ro \
    -e LOCALHOST_PORT_18083_TCP=172.17.42.1:18083 \
    -e LOCALHOST_NAME=default \
    clue/phpvirtualbox
    

This mounts /opt/phpvirtualbox/config-servers.php into /var/www/config-servers.php, and mounts it read-only, which will make it effectively override the one generated by the docker image.

jwalton avatar Jul 23 '15 04:07 jwalton