Vagrant and Docker

2016-02-06 16:00:00
Posted in: Development
Views: 4479

Using Vagrant and Docker to provision a LAMP and a MEAN container

This setup is tested on debian(3.16.7-ckt20-1+deb8u3)

Vagrant.configure("2") do |config|
  #get ubuntu 64 bit image = "hashicorp/precise64"
  #run provisioning bash to setup docker in the vagrant/virtualbox env.
  config.vm.provision :shell, path: "" 
  #map port for LAMP stack (apache/web service only) :forwarded_port, guest: 8080, host: 8080
  #map port for MEAN stack (nodejs/web service only) :forwarded_port, guest: 3000, host: 3000
#!/usr/bin/env bash

printf "\n\n\n Started server provisioning, please wait \n\n\n"

#get docker, and vim 
sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb ubuntu-precise main" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y install docker-engine vim 

#get LAMP container
sudo docker search linode
sudo docker pull linode/lamp
sudo docker run -p 80:8080 -d -i linode/lamp /bin/bash 

#get MEAN container
sudo docker search meanjs
sudo docker pull maccam912/meanjs
sudo docker run -p 3000:3000 -d -i maccam912/meanjs /bin/bash

To get the files from the repo:

Note, tested this and a should mention its very slow and hard on your resources. Virtualisation in virtualisation is expensive.

why-guy add:

Last Tweets: