-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Using packer on Mac OS X with boot2docker
install packer + berkshelf
#berks vendor ./vendor-cookbooks
Install following packages
Homebrew installable packages
- docker
- boot2docker
- packer
ChefDK from opscode.com
- chefdk
Run following commands to start small support vm for docker
boot2docker init
boot2docker up
There is a problem with using packer on Mac OS X. Where packer is not able to comunicate with docker VM running in boot2docker VM. To make it running use this simple commands. First we need to setup a root password in boot2docker vm docker/tcuser.
boot2docker ssh
sudo passwd root
With root account password set
cd docker-tomcat
packer build template.json
From packer output get description of volume definition for docker container, _/var/folders/yq/h9bmb6x1qxb7p4_w5xhkgx80000gn/T/packer-docker198944115.
2014/05/13 16:32:26 ui: docker: Run command: docker run -d -i -t -v /var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/packer-docker198944115:/packer-files phusion/baseimage:0.9.9 /bin/bash
Because of communication trouble packer will halt on installing chef step. To make it continue user needs to mount boot2docker vm directory /var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/packer-docker198944115 to local machine.
packer_dir=packer-docker198944115
umount /var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/${packer_dir}
sshfs -p 2022 root@localhost:/var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/${packer_dir} /var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/${packer_dir}
root@localhost's password:
After mounting fs packer command will continue to build machine and finish the build.