Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vagrantfile for running mongo mysql and postgresql with docker-compose
postgres:
image: postgres:9.4
ports:
- "5432:5432"
environment:
- POSTGRES_USER=docker
- POSTGRES_PASSWORD=docker
mysql:
image: mysql
ports:
- "3306:3306"
environment:
- MYSQL_USER=docker
- MYSQL_PASSWORD=docker
- MYSQL_DATABASE=docker
- MYSQL_ROOT_PASSWORD=docker
mongo:
image: mongo:3
command: "--smallfiles"
restart: always
mem_limit: 100MB
mongo:
image: mongo
ports:
- "27017:27017"
#/bin/bash
vagrant plugin install vagrant-host-shell
vagrant plugin install vagrant-docker-compose
vagrant up --provision
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024", "--cpus", "2"]
end
config.vm.provision "shell", inline:
"curl -sSL https://get.docker.com/ | sh;curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose; chmod +x /usr/local/bin/docker-compose"
config.vm.provision :docker
config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", rebuild: true, run: "always"
config.vm.network :forwarded_port, guest: 5432, host: 7001
config.vm.network :forwarded_port, guest: 3306, host: 7002
config.vm.network :forwarded_port, guest: 27017, host: 7003
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment