Skip to content

Instantly share code, notes, and snippets.

@komiya-atsushi
Created August 20, 2014 17:19
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 komiya-atsushi/49414ea19917414a4e48 to your computer and use it in GitHub Desktop.
Save komiya-atsushi/49414ea19917414a4e48 to your computer and use it in GitHub Desktop.
Docker official ぽい MySQL のイメージを利用するデモ。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
PROVISION = <<SCRIPT
curl -s https://get.docker.io/ubuntu/ | sh
docker pull mysql
docker run \
-p 3306:3306 \
--name docker-mysql-demo \
-e MYSQL_ROOT_PASSWORD=demo \
-d \
mysql
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "docker-official-mysql"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine.
config.vm.network "forwarded_port", guest: 3306, host: 13306
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--memory", 1024 ]
end
config.vm.provision "shell", inline: PROVISION
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment