help w/ my hanging Packer docker build

464 views
Skip to first unread message

Russell Roy

unread,
Feb 20, 2014, 1:50:24 PM2/20/14
to packe...@googlegroups.com
I'm trying to use packer to build a docker image via a chef-solo provisioner with a jenkins cookbook.

Here's my packer file...
{
    "builders": [{
   "type": "docker",
"image": "linux/chef-solo",
"export_path": "image.tar"
    }],
    "provisioners": [{
   "type": "chef-solo",
   "cookbook_paths": ["./chef-repo/cookbooks/"],
"run_list" : ["jenkins::master"],
"prevent_sudo" : false,
"skip_install" : false
    }]
}
 
When I run 'packer build my_packer_file.json' the silly thing just hangs on me (wait forever).   Here's the (partial) debug output:

...
==> docker: Pulling Docker image: linux/chef-solo
2014/02/20 10:59:32 ui: ==> docker: Pulling Docker image: linux/chef-solo
2014/02/20 10:59:32 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:32 Executing: /Users/rroy/bin/docker [pull linux/chef-solo]
    docker: Pulling repository linux/chef-solo
2014/02/20 10:59:32 ui:     docker: Pulling repository linux/chef-solo
==> docker: Starting docker container...
2014/02/20 10:59:33 ui: ==> docker: Starting docker container...
    docker: Run command: docker run -d -i -t -v /var/folders/sv/fg0chmkx62v3p8sw2kwz1sf80000gp/T/packer-docker454976570:/packer-files linux/chef-solo /bin/bash
2014/02/20 10:59:33 ui:     docker: Run command: docker run -d -i -t -v /var/folders/sv/fg0chmkx62v3p8sw2kwz1sf80000gp/T/packer-docker454976570:/packer-files linux/chef-solo /bin/bash
2014/02/20 10:59:33 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:33 Starting container with args: [run -d -i -t -v /var/folders/sv/fg0chmkx62v3p8sw2kwz1sf80000gp/T/packer-docker454976570:/packer-files linux/chef-solo /bin/bash]
2014/02/20 10:59:33 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:33 Waiting for container to finish starting
    docker: Container ID: 055fa7ef416523fc59606e872a715ec61b45fbe07dc5f5a70fbc0124ddbb9479
2014/02/20 10:59:33 ui:     docker: Container ID: 055fa7ef416523fc59606e872a715ec61b45fbe07dc5f5a70fbc0124ddbb9479
2014/02/20 10:59:33 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:33 Running the provision hook
==> docker: Provisioning with chef-solo
2014/02/20 10:59:33 ui: ==> docker: Provisioning with chef-solo
    docker: Installing Chef...
2014/02/20 10:59:33 ui:     docker: Installing Chef...
2014/02/20 10:59:33 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:33 Executing in container 055fa7ef416523fc59606e872a715ec61b45fbe07dc5f5a70fbc0124ddbb9479: "(curl -Lhttps://www.opscode.com/chef/install.sh | sudo bash) >/packer-files/cmd564715601 2>&1; echo $? >/packer-files/cmd564715601-exit"
2014/02/20 10:59:35 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/20 10:59:35 Waiting for exit code to appear for remote command...


---------------

If I shell into that container and run the command it seems to complete ok (below.)     Any ideas?

- Russ

(PS:   On another point though...  I don't understand why it wants to try to install chef-solo to begin with when I'm starting w/ a docker linux(ubuntu)/chef-solo image.)


root@cc6fdd951c70:/# curl -L https://www.opscode.com/chef/install.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13347  100 13347    0     0  71437      0 --:--:-- --:--:-- --:--:-- 88390
Downloading Chef  for ubuntu...
downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&p=ubuntu&pv=12.04&m=x86_64
  to file /tmp/install.sh.11/metadata.txt
trying curl...
url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.10.2-1.ubuntu.12.04_amd64.deb
md5 6758caf8e0e0f4c3c21490e4772668f9
sha256 8e767884eaec1169457500adbcd7ee5683f31ca6cbe4673a063419853c45d2d4
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.10.2-1.ubuntu.12.04_amd64.deb
  to file /tmp/install.sh.11/chef_11.10.2-1.ubuntu.12.04_amd64.deb
trying curl...
Checksum compare with sha256sum succeeded.
Installing Chef 
installing with dpkg...
(Reading database ... 29011 files and directories currently installed.)
Preparing to replace chef 11.10.0-1.ubuntu.12.04 (using .../chef_11.10.2-1.ubuntu.12.04_amd64.deb) ...
Unpacking replacement chef ...
Setting up chef (11.10.2-1.ubuntu.12.04) ...
Thank you for installing Chef!
root@cc6fdd951c70:

Russell Roy

unread,
Feb 21, 2014, 8:57:44 AM2/21/14
to packe...@googlegroups.com
My original posting was somewhat in error:  as originally shown, when my build hung, from a separate terminal window I'd attached to a what I thought was the correct running container (but as you can see from my log output I'd actually run a *new* container.)    I've since recreated the problem scenario, attached to the correct running container in which the running build is hung, and looked to see that the temp file the build is waiting on does in fact exist: /packer-files/cmd870430499-exit with contents "0".

2014/02/21 08:28:31 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/21 08:28:31 Executing in container 73f2961fee6988f4f2da2d3328a04bdb73d5e240704ec6f1af58cd72576f24a5: "(curl -L https://www.opscode.com/chef/install.sh | sudo bash) >/packer-files/cmd870430499 2>&1; echo $? >/packer-files/cmd870430499-exit"
2014/02/21 08:28:33 /Users/rroy/0.5.1_darwin_amd64/packer-builder-docker: 2014/02/21 08:28:33 Waiting for exit code to appear for remote command...

So ... I suspect a bug in the packer-builder-docker module whereby somehow it's not waking up when this file comes into existence.
Reply all
Reply to author
Forward
0 new messages