i'm trying use packer build docker image of webapp i'm working on. whenever run packer build
, when gets step runs runit
recipe, build 'docker' errored: error executing chef: non-zero exit status: 137
i looked 137, , found out exit code commonly associated kill -9
. in cases imply system running critically low on memory, , system attempting compensate.
i tried find smallest possible reproduction, , came packer configuration:
{ "builders":[{ "type": "docker", "pull": false, "image": "silkstart/basic_server", "export_path": "image.tar", "run_command":[ "-d", "-i", "-t", "--memory-reservation", "1g", "{{.image}}", "/bin/bash" ] }], "provisioners":[ { "type": "chef-solo", "cookbook_paths": ["cookbooks", "vendor/cookbooks"], "data_bags_path": "data_bags", "roles_path": "roles", "environments_path": "environments", "run_list": [ "recipe[runit]" ] } ], "post-processors": [ { "type": "docker-import", "repository": "silkstart/docker_test", "tag": "0.1" } ] }
when run packer build
on configuration, output:
tmpdir=/opt/shared packer build packer_files/docker_test.json docker output in color. ==> docker: creating temporary directory sharing data... ==> docker: starting docker container... docker: run command: docker run -v /opt/shared/packer-docker484290992:/packer-files -d -i -t --memory-reservation 1g silkstart/basic_server /bin/bash docker: container id: 1f87b0cf1fe71f07b580ae6b18415a79c23a1a32a40f5f0366be90f160977a50 ==> docker: provisioning chef-solo docker: installing chef... docker: % total % received % xferd average speed time time time current docker: dload upload total spent left speed docker: 100 20022 100 20022 0 0 45092 0 --:--:-- --:--:-- --:--:-- 45196 docker: getting information chef stable ubuntu... docker: downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=&p=ubuntu&pv=14.04&m=x86_64 docker: file /tmp/install.sh.23/metadata.txt docker: trying curl... docker: url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/14.04/x86_64/chef_12.6.0-1_amd64.deb docker: md5 5cfc19d5a036b3f7860716bc9795a85e docker: sha256 e0b42748daf55b5dab815a8ace1de06385db98e29a27ca916cb44f375ef65453 docker: version 12.6.0downloaded metadata file looks valid... docker: downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/14.04/x86_64/chef_12.6.0-1_amd64.deb docker: file /tmp/install.sh.23/chef_12.6.0-1_amd64.deb docker: trying curl... docker: comparing checksum sha256sum... docker: docker: warning warning warning warning warning warning warning warning warning docker: docker: installing omnibus package without version pin. if installing docker: on production servers via automated process dangerous , docker: upgraded without warning on new releases, new major releases. docker: letting version float appropriate in desktop, test, development or docker: ci/cd environments. docker: docker: warning warning warning warning warning warning warning warning warning docker: docker: installing chef docker: installing dpkg... docker: selecting unselected package chef. docker: (reading database ... 17195 files , directories installed.) docker: preparing unpack .../chef_12.6.0-1_amd64.deb ... docker: unpacking chef (12.6.0-1) ... docker: setting chef (12.6.0-1) ... docker: thank installing chef! docker: creating directory: /tmp/packer-chef-solo docker: creating directory: /tmp/packer-chef-solo/cookbooks-0 docker: creating directory: /tmp/packer-chef-solo/cookbooks-1 docker: creating directory: /tmp/packer-chef-solo/roles docker: creating directory: /tmp/packer-chef-solo/data_bags docker: creating directory: /tmp/packer-chef-solo/environments docker: creating configuration file 'solo.rb' docker: creating json attribute file docker: executing chef: sudo chef-solo --no-color -c /tmp/packer-chef-solo/solo.rb -j /tmp/packer-chef-solo/node.json docker: [2016-01-29t06:42:48+00:00] info: forking chef instance converge... docker: [2016-01-29t06:42:48+00:00] info: *** chef 12.6.0 *** docker: [2016-01-29t06:42:48+00:00] info: chef-client pid: 207 docker: [2016-01-29t06:42:50+00:00] info: setting run_list ["recipe[runit]"] cli options docker: [2016-01-29t06:42:50+00:00] info: run list [recipe[runit]] docker: [2016-01-29t06:42:50+00:00] info: run list expands [runit] docker: [2016-01-29t06:42:50+00:00] info: starting chef run 1f87b0cf1fe7 docker: [2016-01-29t06:42:50+00:00] info: running start handlers docker: [2016-01-29t06:42:50+00:00] info: start handlers complete. docker: [2016-01-29t06:42:52+00:00] info: processing service[runit] action nothing (runit::default line 20) docker: [2016-01-29t06:42:52+00:00] info: processing execute[start-runsvdir] action nothing (runit::default line 24) docker: [2016-01-29t06:42:52+00:00] info: processing execute[runit-hup-init] action nothing (runit::default line 33) docker: [2016-01-29t06:42:52+00:00] info: processing apt_package[runit] action install (runit::default line 64) docker: [2016-01-29t06:42:55+00:00] info: processing cookbook_file[/var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed] action create (dynamically defined) docker: [2016-01-29t06:42:55+00:00] info: cookbook_file[/var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed] created file /var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed docker: [2016-01-29t06:42:55+00:00] info: cookbook_file[/var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed] updated file contents /var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed docker: [2016-01-29t06:42:55+00:00] info: apt_package[runit] pre-seeding package installation instructions ==> docker: killing container: 1f87b0cf1fe71f07b580ae6b18415a79c23a1a32a40f5f0366be90f160977a50 build 'docker' errored: error executing chef: non-zero exit status: 137
i'm not entirely sure causing code 137, , appreciated.
update 1
i'm including gist of full debug output chef. it's more verbose, due seem of attempts ohai makes information.
https://gist.github.com/jrstarke/4c5f3b432aaee70c7f77
no references in here seem suggest out of memory error, @ least on docker host.
after much digging, found problem. underlying problem, , solution both found on issue in cloudfoundry-incubator/garden-linux.
apparently part of setup process 1 of post init scripts runit
executes kill -s hup 1
. why i'm not entirely sure, noted there, doing trap '' hup
right before apt-get install runit
, trap hup
afterwards totally solved problem.
Comments
Post a Comment