Example setup on Mac
People can use boot2docker or docker machine to provison a docker vm , I would like use vagrant myself to better understand the architecture.
install vagrant & vbox (5.0.3) https://www.virtualbox.org/download/testcase/VirtualBox-5.0.3-102165-OSX.dmg
Use attached Vagrantfile to provision jessie64
Put it into your vm dir , eg. ~/dev/vm/jessie and then
cd ~/dev/vm/jessie && vagrant up
~vm$ sudo echo 'deb http://http.debian.net/debian-backports squeeze-backports(-sloppy) main' > /etc/apt/sources.list.d/backports.list
~vm$ sudo apt-get update && sudo apt-get install docker.io && sudo gpasswd -a vagrant docker && sudo service docker restart
create dockervm.command as attached and drag it into OSX dock
vi wheezy/Dockerfile
add line "apt-get install -y python" and save
docker build -t local/debian wheezy/
docker build -t local/centos centos6
ssh-keygen -t rsa -b 4096 -C "ansible@local"
Specify the file name as ~/.ssh/docker.pem
docker run --name dev -d -p 2222:22 -e AUTHORIZED_KEYS="
cat ~/.ssh/docker.pem.pub
" local/debian
docker run --name dev2 -d -p 2224:22 -e AUTHORIZED_KEYS="
cat ~/.ssh/docker.pem.pub
" local/centos
docker ps
mkdir ~/dev/work
Use ansible.cfg and inventory file as attached
test setting with
ansible -m ping all
Use the attached test.yaml to verify docker instance configuration
Hi there. I can't understand this line. How does this works? Where do I have to put the inventory file? The hosts file is omitted, why?