Closed bridiver closed 9 years ago
also on ubuntu
+1. I've tried this on centos:centos6, centos:centos7, and ubuntu:latest. Same result on all. Packer Version 0.7.5 docker-machine version 0.1.0 using Virtualbox driver Host is running OSX 10.9.5
$ docker version Client version: 1.5.0 Client API version: 1.17 Go version (client): go1.4.1 Git commit (client): a8a31ef OS/Arch (client): darwin/amd64 Server version: 1.5.0 Server API version: 1.17 Go version (server): go1.4.1 Git commit (server): a8a31ef
What happens if you run that script manually or in debug mode? It looks to be an issue with Chef's installer, although I don't see an error coming back from it.
Here's the latest output:
laptop99:Desktop user99$ packer build -debug ~/Desktop/packer_docker.json
2015/03/17 11:40:17 [INFO] Packer version: 0.7.5 9cd66feeacbd9cb318b72eb5ed59428c5b8c37ac+CHANGES
2015/03/17 11:40:17 Packer Target OS/Arch: darwin amd64
2015/03/17 11:40:17 Built with Go Version: go1.3.3
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-chroot = /usr/local/packer/packer-builder-amazon-chroot
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-ebs = /usr/local/packer/packer-builder-amazon-ebs
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-instance = /usr/local/packer/packer-builder-amazon-instance
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: digitalocean = /usr/local/packer/packer-builder-digitalocean
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker = /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: googlecompute = /usr/local/packer/packer-builder-googlecompute
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: null = /usr/local/packer/packer-builder-null
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: openstack = /usr/local/packer/packer-builder-openstack
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: parallels-iso = /usr/local/packer/packer-builder-parallels-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: parallels-pvm = /usr/local/packer/packer-builder-parallels-pvm
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: qemu = /usr/local/packer/packer-builder-qemu
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: virtualbox-iso = /usr/local/packer/packer-builder-virtualbox-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: virtualbox-ovf = /usr/local/packer/packer-builder-virtualbox-ovf
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vmware-iso = /usr/local/packer/packer-builder-vmware-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vmware-vmx = /usr/local/packer/packer-builder-vmware-vmx
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: atlas = /usr/local/packer/packer-post-processor-atlas
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: compress = /usr/local/packer/packer-post-processor-compress
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-import = /usr/local/packer/packer-post-processor-docker-import
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-push = /usr/local/packer/packer-post-processor-docker-push
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-save = /usr/local/packer/packer-post-processor-docker-save
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-tag = /usr/local/packer/packer-post-processor-docker-tag
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vagrant = /usr/local/packer/packer-post-processor-vagrant
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vagrant-cloud = /usr/local/packer/packer-post-processor-vagrant-cloud
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vsphere = /usr/local/packer/packer-post-processor-vsphere
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: ansible-local = /usr/local/packer/packer-provisioner-ansible-local
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: chef-client = /usr/local/packer/packer-provisioner-chef-client
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: chef-solo = /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: file = /usr/local/packer/packer-provisioner-file
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: puppet-masterless = /usr/local/packer/packer-provisioner-puppet-masterless
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: puppet-server = /usr/local/packer/packer-provisioner-puppet-server
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: salt-masterless = /usr/local/packer/packer-provisioner-salt-masterless
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: shell = /usr/local/packer/packer-provisioner-shell
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Attempting to open config file: /Users/user99/.packerconfig
2015/03/17 11:40:17 File doesn't exist, but doesn't need to. Ignoring.
2015/03/17 11:40:17 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[amazon-instance:/usr/local/packer/packer-builder-amazon-instance digitalocean:/usr/local/packer/packer-builder-digitalocean null:/usr/local/packer/packer-builder-null virtualbox-iso:/usr/local/packer/packer-builder-virtualbox-iso vmware-iso:/usr/local/packer/packer-builder-vmware-iso parallels-iso:/usr/local/packer/packer-builder-parallels-iso qemu:/usr/local/packer/packer-builder-qemu vmware-vmx:/usr/local/packer/packer-builder-vmware-vmx amazon-ebs:/usr/local/packer/packer-builder-amazon-ebs docker:/usr/local/packer/packer-builder-docker googlecompute:/usr/local/packer/packer-builder-googlecompute amazon-chroot:/usr/local/packer/packer-builder-amazon-chroot openstack:/usr/local/packer/packer-builder-openstack parallels-pvm:/usr/local/packer/packer-builder-parallels-pvm virtualbox-ovf:/usr/local/packer/packer-builder-virtualbox-ovf] PostProcessors:map[docker-save:/usr/local/packer/packer-post-processor-docker-save vagrant:/usr/local/packer/packer-post-processor-vagrant vsphere:/usr/local/packer/packer-post-processor-vsphere atlas:/usr/local/packer/packer-post-processor-atlas docker-import:/usr/local/packer/packer-post-processor-docker-import docker-push:/usr/local/packer/packer-post-processor-docker-push docker-tag:/usr/local/packer/packer-post-processor-docker-tag vagrant-cloud:/usr/local/packer/packer-post-processor-vagrant-cloud compress:/usr/local/packer/packer-post-processor-compress] Provisioners:map[chef-solo:/usr/local/packer/packer-provisioner-chef-solo file:/usr/local/packer/packer-provisioner-file puppet-masterless:/usr/local/packer/packer-provisioner-puppet-masterless puppet-server:/usr/local/packer/packer-provisioner-puppet-server salt-masterless:/usr/local/packer/packer-provisioner-salt-masterless shell:/usr/local/packer/packer-provisioner-shell ansible-local:/usr/local/packer/packer-provisioner-ansible-local chef-client:/usr/local/packer/packer-provisioner-chef-client]}
2015/03/17 11:40:17 Setting cache directory: /Users/user99/Desktop/packer_cache
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Reading template: /Users/user99/Desktop/packer_docker.json
2015/03/17 11:40:17 Creating build: docker
2015/03/17 11:40:17 Loading builder: docker
2015/03/17 11:40:17 Creating plugin client for path: /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 Starting plugin: /usr/local/packer/packer-builder-docker []string{"/usr/local/packer/packer-builder-docker"}
2015/03/17 11:40:17 Waiting for RPC address for: /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin minimum port: 10000
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin maximum port: 25000
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin address: unix /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-plugin344113431
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Waiting for connection...
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Serving a plugin connection...
2015/03/17 11:40:17 Loading provisioner: chef-solo
2015/03/17 11:40:17 Creating plugin client for path: /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 Starting plugin: /usr/local/packer/packer-provisioner-chef-solo []string{"/usr/local/packer/packer-provisioner-chef-solo"}
2015/03/17 11:40:17 Waiting for RPC address for: /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin minimum port: 10000
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin maximum port: 25000
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin address: unix /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-plugin062608027
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Waiting for connection...
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Serving a plugin connection...
2015/03/17 11:40:17 ui: Debug mode enabled. Builds will not be parallelized.
2015/03/17 11:40:17 ui: docker output will be in this color.
2015/03/17 11:40:17 ui:
2015/03/17 11:40:17 Build debug mode: true
2015/03/17 11:40:17 Force build: false
2015/03/17 11:40:17 Preparing build: docker
Debug mode enabled. Builds will not be parallelized.
docker output will be in this color.
2015/03/17 11:40:17 Debug enabled, so waiting for build to finish: docker
2015/03/17 11:40:17 Starting build run: docker
2015/03/17 11:40:17 Running builder: docker
2015/03/17 11:40:17 ui: ==> docker: Creating a temporary directory for sharing data...
==> docker: Creating a temporary directory for sharing data...
2015/03/17 11:40:17 ui: ask: ==> docker: Pausing after run of step 'StepTempDir'. Press enter to continue.
==> docker: Pausing after run of step 'StepTempDir'. Press enter to continue.
2015/03/17 11:40:20 ui: scan err: unexpected newline
2015/03/17 11:40:20 packer-builder-docker: 2015/03/17 11:40:20 Pull disabled, won't docker pull
2015/03/17 11:40:20 ui: ask: ==> docker: Pausing after run of step 'StepPull'. Press enter to continue.
==> docker: Pausing after run of step 'StepPull'. Press enter to continue.
2015/03/17 11:40:21 ui: scan err: unexpected newline
2015/03/17 11:40:21 ui: ==> docker: Starting docker container...
==> docker: Starting docker container...
2015/03/17 11:40:21 ui: docker: Run command: docker run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/17 11:40:21 packer-builder-docker: 2015/03/17 11:40:21 Starting container with args: [run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash]
docker: Run command: docker run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/17 11:40:21 packer-builder-docker: 2015/03/17 11:40:21 Waiting for container to finish starting
2015/03/17 11:40:22 ui: docker: Container ID: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:40:22 ui: ask: ==> docker: Pausing after run of step 'StepRun'. Press enter to continue.
docker: Container ID: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
==> docker: Pausing after run of step 'StepRun'. Press enter to continue.
2015/03/17 11:40:26 ui: scan err: unexpected newline
2015/03/17 11:40:26 packer-builder-docker: 2015/03/17 11:40:26 Running the provision hook
2015/03/17 11:40:26 ui: ==> docker: Provisioning with chef-solo
==> docker: Provisioning with chef-solo
2015/03/17 11:40:26 ui: docker: Installing Chef...
docker: Installing Chef...
2015/03/17 11:40:26 packer-builder-docker: 2015/03/17 11:40:26 Executing in container 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4: "(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit"
2015/03/17 11:40:28 packer-builder-docker: 2015/03/17 11:40:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/17 11:40:28 [INFO] 0 bytes written for 'stderr'
2015/03/17 11:40:28 [INFO] 0 bytes written for 'stdout'
2015/03/17 11:40:28 [INFO] RPC client: Communicator ended with: 1
2015/03/17 11:40:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] 0 bytes written for 'stdout'
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] 0 bytes written for 'stderr'
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] RPC client: Communicator ended with: 1
2015/03/17 11:40:28 ui: ask: ==> docker: Pausing before cleanup of step 'StepRun'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepRun'. Press enter to continue.
==> docker: Killing the container: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:50:22 ui: scan err: unexpected newline
2015/03/17 11:50:22 ui: ==> docker: Killing the container: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:50:23 ui: ask: ==> docker: Pausing before cleanup of step 'StepPull'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepPull'. Press enter to continue.
2015/03/17 11:50:23 ui: scan err: unexpected newline
2015/03/17 11:50:23 ui: ask: ==> docker: Pausing before cleanup of step 'StepTempDir'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepTempDir'. Press enter to continue.
2015/03/17 11:50:24 ui: scan err: unexpected newline
2015/03/17 11:50:24 ui error: Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/17 11:50:24 Waiting on builds to complete...
2015/03/17 11:50:24 Builds completed. Waiting on interrupt barrier...
2015/03/17 11:50:24 machine readable: error-count []string{"1"}
2015/03/17 11:50:24 ui error:
==> Some builds didn't complete successfully and had errors:
2015/03/17 11:50:24 machine readable: docker,error []string{"Error installing Chef: Install script exited with non-zero exit status 1"}
2015/03/17 11:50:24 ui error: --> docker: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/17 11:50:24 ui:
==> Builds finished but no artifacts were created.
2015/03/17 11:50:24 waiting for all plugin processes to complete...
Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1
==> Some builds didn't complete successfully and had errors:
--> docker: Error installing Chef: Install script exited with non-zero exit status 1
==> Builds finished but no artifacts were created.
2015/03/17 11:50:24 /usr/local/packer/packer-provisioner-chef-solo: plugin process exited
2015/03/17 11:50:24 /usr/local/packer/packer-builder-docker: plugin process exited
laptop99:Desktop user99$
If if attach into the container when it pauses after the chef error and run the following command manually, it completes successfully.
(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit
Okay, so it looks like the Chef omnibus installer is failing to installer (or returning a failing status).
It is working with this patch https://github.com/mitchellh/packer/issues/1752
Yeah, the problem is it doesn't generate any logs inside the container when run automatically. The /packer-files directory is empty.
When running manually it generates the logs and shows a clean chef-client install.
[root@08520d2e418b /]# (curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit [root@08520d2e418b /]# cd packer-files/ [root@08520d2e418b packer-files]# ls cmd188380513 cmd188380513-exit [root@08520d2e418b packer-files]# cat cmd188380513 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18378 100 18378 0 0 70607 0 --:--:-- --:--:-- --:--:-- 208k Downloading Chef for el... downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64 to file /tmp/install.sh.16/metadata.txt trying curl... url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm md5 01e4e0e2688c297590134f4070956148 sha256 1ed7d17df3f11069f19f31c6bbe4101b55334bf4ba6e96f8d022cb6750b48a63 downloaded metadata file looks valid... downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm to file /tmp/install.sh.16/chef-12.1.1-1.el6.x86_64.rpm trying curl... Comparing checksum with sha256sum... Installing Chef installing with rpm... warning: /tmp/install.sh.16/chef-12.1.1-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ################################################## chef ################################################## Thank you for installing Chef! [root@08520d2e418b packer-files]#
I'll try that patch out in a bit and report back. Thanks.
I tried the patch and got just past that point. It hangs here:
2015/03/17 13:09:30 packer-builder-docker: 2015/03/17 13:09:30 Executing in container 5a8e63c1fe544301200447fdb98e2425de37f036e020d3f71b1135ec96885143: "(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd724628349 2>&1; echo $? >/packer-files/cmd724628349-exit" 2015/03/17 13:09:45 packer-builder-docker: 2015/03/17 13:09:45 Waiting for exit code to appear for remote command...
I attached to the container and verified that chef client installed successfully, and wrote the exit code to the exit file.
[root@5a8e63c1fe54 packer-files]# pwd /packer-files [root@5a8e63c1fe54 packer-files]# cat cmd724628349 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18378 100 18378 0 0 53317 0 --:--:-- --:--:-- --:--:-- 121k Downloading Chef for el... downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64 to file /tmp/install.sh.19/metadata.txt trying curl... url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm md5 01e4e0e2688c297590134f4070956148 sha256 1ed7d17df3f11069f19f31c6bbe4101b55334bf4ba6e96f8d022cb6750b48a63 downloaded metadata file looks valid... downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm to file /tmp/install.sh.19/chef-12.1.1-1.el6.x86_64.rpm trying curl... Comparing checksum with sha256sum... Installing Chef installing with rpm... warning: /tmp/install.sh.19/chef-12.1.1-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ################################################## chef ################################################## Thank you for installing Chef! [root@5a8e63c1fe54 packer-files]# cat cmd724628349-exit 0 [root@5a8e63c1fe54 packer-files]#
Not sure now if this goes back to an issue with the Chef provisioner or an issue with the Docker builder.
Actually it looks like it's the Docker builder. I'm hitting the same issue with the shell provisioner.
@johnpbyrne is this in OSX under boot2docker (/ docker-machine)? Try your (or my) patched version with mkdir ~/tmp && TMPDIR=$HOME/tmp packer build
@donaldguy that fixed it. Thanks.
Fixed
This also failed with the standard install command and on centos7