Docker Machine with Openstack

You can build a private docker cloud by using docker-machine with openstack.

1. Install docker-machine.

curl -L https://github.com/docker/machine/releases/download/v0.12.1/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

2. Source openstack-rc.sh

3. Docker-machine create new docker installed instance.

docker-machine create -d openstack –openstack-net-id 5ce399f3-fd56-42eb-8ca0-7e0f4a109e51 –openstack-flavor-name m1-small –openstack-image-id d4a5378f-73f2-44ec-b8b8-498d299a6c55 –openstack-domain-name –openstack-ssh-user ubuntu default docker

4. Docker-compose to run docker ymal
curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

version: “2”
services:
db:
environment:
– MYSQL_DATABASE=wordpressdb
– MYSQL_PASSWORD=123sqwert
– MYSQL_ROOT_PASSWORD=123sqwert
– MYSQL_USER=admin
image: ‘mariadb:latest’
container_name: wordpress_db
ports:
– ‘3306:3306’
volumes:
– ‘/var/www/db:/var/www/db’

web:
ports:
– ’80:80′
image: ‘wordpress:latest’
container_name: wordpress_web
links:
– db
volumes:
– ‘/var/www/html:/var/www/html’