Skip to content

Instantly share code, notes, and snippets.

@clintkitson
Last active July 13, 2016 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clintkitson/d4eed36f909d3636567828827b2d8015 to your computer and use it in GitHub Desktop.
Save clintkitson/d4eed36f909d3636567828827b2d8015 to your computer and use it in GitHub Desktop.
// Create a Polly host and a Docker engine host
docker-machine create --driver=virtualbox --virtualbox-cpu-count=2 polly
eval $(docker-machine env polly)
docker-machine create --driver=virtualbox agent1
// Install and configure Polly. Edit the user_name for your own valid path for new volumes of VirtualBox.
for each in $(echo -e "polly\n"); do docker-machine ssh $each "curl -sSL https://dl.bintray.com/emccode/polly/install | sh -s stable" ; done
for each in $(echo -e "polly\n"); do docker-machine ssh $each "sudo tee -a /etc/polly/config.yml << EOF
polly:
host: tcp://127.0.0.1:7978
store:
type: boltdb
endpoints: /tmp/boltdb
bucket: MyBoltDb_test
libstorage:
host: tcp://127.0.0.1:7981
embedded: false
client:
type: controller
server:
endpoints:
localhost:
address: tcp://:7981
services:
virtualbox:
driver: virtualbox
virtualbox:
endpoint: http://10.0.2.2:18083
tls: false
volumePath: /Users/clintonkitson/VirtualBox Volumes
controllerName: SATA
" ; done
// Start the Polly service
for each in $(echo -e "polly\n"); do docker-machine ssh $each "sudo polly start" ; done
// Install and configure Docker engine host with REX-Ray talking to Polly
for each in $(echo -e "agent1\n"); do docker-machine ssh $each "curl -sSL https://dl.bintray.com/emccode/rexray/install | sh -s stable" ; done
POLLY_IP=`docker-machine ip polly`
for each in $(echo -e "agent1\n"); do docker-machine ssh $each "sudo tee -a /etc/rexray/config.yml << EOF
rexray:
modules:
default-docker:
type: docker
desc: "The default docker module."
host: "unix:///run/docker/plugins/polly.sock"
libstorage:
service: virtualbox
host: tcp://$POLLY_IP:7981
libstorage:
service: virtualbox
" ; done
// Start REX-Ray (0.4.0)
for each in $(echo -e "agent1\n"); do docker-machine ssh $each "sudo rexray start" ; done
// Set Docker CLI to use agent instance
eval $(docker-machine env agent1)
// SSH to Polly host
docker-machine ssh polly
sudo su
// Get polly volumes (should be empty)
polly volume get
// Get polly volumes available to be offered (should be populated from VirtualBox)
polly volume get --all
// Offer a volume
polly volume offer --volumeid=chooseone --scheduler=swarm_virtualbox
exit
exit
// Review available volumes to Docker (see your volume)
docker volume ls
// Create a new volume
docker volume create --driver=polly --name=testing --opt=size=2
// Run a container with volumes (see volume attached)
docker run -ti --volume-driver=polly -v testing:/testing busybox
df
exit
// Revoke a volume
docker-machine ssh polly
sudo polly volume
sudo polly volume revoke --volumeid="volumeid" --scheduler="swarm_virtualbox"
exit
// Show volumes (volume should be gone)
docker volume ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment