chef-boneyard / knife-container

DEPRECATED: Container support for Chef's Knife Command
Apache License 2.0
57 stars 11 forks source link

knife container docker build run forever #21

Closed chrisduong closed 10 years ago

chrisduong commented 10 years ago

Hi,

I make Dockerfile with this command: $ knife container docker init chef/precise_apache2 -r 'recipe[apache2]' -b After successfully, I launch this: $ knife container docker build chef/precise_apache2 -VV The terminal open ➜ precise64.cookbook knife container docker build chef/precise_apache2 -VV Failed to load /home/cduong/.gemrc because it doesn't contain valid YAML hash 3.1.3 Resolving cookbook dependencies... Using apache2 (2.0.0) Using logrotate (1.6.0) Using iptables (0.13.2) Using pacman (1.1.1)

^C^C%

It had been running more than 5mins after the line "Using pacman ...". then I have to Control+C to break it. Please help, thanks.

tduffield commented 10 years ago

Based on the information you provided me, I do not know what is wrong. There are a couple of things that could be at play here.

  1. There is something wrong with your Berkshelf installation. The phase your run stalled during is triggered by shelling out directly to berks. I would make sure that Berkshelf works for you outside of knife-container. You could do this by simply running berks install in your terminal from your docker context directory.
  2. Docker has a tendency to not show 100% of the logs when you run docker build. It possible that your build froze at another location but the logs just didn't make it to STDOUT yet. I would take a look at the docker logs for that intermediate container to see if anything else shows up.

Also, does this happen repeatedly? Does it happen every time you run knife container docker build?

chrisduong commented 10 years ago

Hi,

I tried to use Berkshelf to manage dependencies in apache2 cookbook and all of its dependencies. And knife container docker build again. It still stops responding right after "fetching all cookbook index"

➜ precise64.cookbook knife container docker build chef/precise_apache2 -VV 3.1.3 Resolving cookbook dependencies... Fetching cookbook index from https://api.berkshelf.com... Using apache2 (2.0.0) Using iptables (0.13.2) Using logrotate (1.6.0) Using pacman (1.1.1)

The container has not been created and launched yet

Maybe my internet connection is not good. I'm still debugging, I'll let you know when I found sth.

tduffield commented 10 years ago

Based on your output it looks like it is freezing during the berks upload phase. Can you please run the following commands from your context directory and share the output? That might indicate whether there is a problem or if your connection is simply slow.

$ berks install -d
$ berks upload -d
chrisduong commented 10 years ago

Hi,

berks install -d && berks upload -d look normal. Now, I'm facing the new problem

➜ precise64.cookbook knife container docker build chef/precise_apache2 -VV 3.1.3 Resolving cookbook dependencies... Fetching cookbook index from https://api.berkshelf.com... Using apache2 (2.0.0) Using logrotate (1.6.0) Using iptables (0.13.2) Using pacman (1.1.1) /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:357:in each': task was terminated (Celluloid::Task::TerminatedError) from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:357:incleanup' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:341:in shutdown' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:333:inhandle_crash' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:162:in rescue in run' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:148:inrun' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor.rb:130:in block in start' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/thread_handle.rb:13:inblock in initialize' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/actor_system.rb:32:in block in get_thread' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/internal_pool.rb:99:incall' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/internal_pool.rb:99:in block in create' from (celluloid):0:inremote procedure call' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/calls.rb:92:in value' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0.pre2/lib/celluloid/proxies/sync_proxy.rb:33:inmethod_missing' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/uploader.rb:54:in block (2 levels) in upload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/uploader.rb:50:ineach' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/uploader.rb:50:in block in upload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ridley-4.0.0/lib/ridley/client.rb:36:inopen' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ridley-4.0.0/lib/ridley.rb:51:in open' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf.rb:157:inridley_connection' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/uploader.rb:49:in upload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/uploader.rb:36:inrun' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/berksfile.rb:542:in upload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/cli.rb:208:inupload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/cli.rb:52:indispatch' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/lib/berkshelf/cli.rb:27:inexecute!' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.3/bin/berks:5:in <top (required)>' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/bin/berks:23:inload' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/bin/berks:23:in `

' Sending build context to Docker daemon 11.78 kB Sending build context to Docker daemon Step 0 : FROM chef/precise_apache2 ---> cc83fc2b4611 Step 1 : ADD chef/ /etc/chef/ ---> 26308d2a750c Removing intermediate container 3a2bb1d0c026 Step 2 : RUN chef-init --bootstrap ---> Running in 049d84aa63bd [2014-08-15T02:59:33+00:00] INFO: Starting Supervisor... [2014-08-15T02:59:33+00:00] INFO: Supervisor pid: 10 [2014-08-15T02:59:38+00:00] INFO: Starting chef-client run... [2014-08-15T02:59:39+00:00] INFO: Forking chef instance to converge... [2014-08-15T02:59:39+00:00] INFO: * Chef 11.12.8 * [2014-08-15T02:59:39+00:00] INFO: Chef-client pid: 17 [2014-08-15T02:59:41+00:00] INFO: Client key /etc/chef/secure/client.pem is not present - registering [2014-08-15T02:59:45+00:00] INFO: HTTP Request Returned 404 Object Not Found: error [2014-08-15T02:59:48+00:00] INFO: Setting the run_list to ["recipe[apache2]"] from CLI options [2014-08-15T02:59:48+00:00] INFO: Run List is [recipe[apache2]] [2014-08-15T02:59:48+00:00] INFO: Run List expands to [apache2] [2014-08-15T02:59:48+00:00] INFO: Starting Chef Run for chef-precise_apache2-build [2014-08-15T02:59:48+00:00] INFO: Running start handlers [2014-08-15T02:59:48+00:00] INFO: Start handlers complete. [2014-08-15T02:59:53+00:00] INFO: Loading cookbooks [apache2@1.11.0, iptables@0.13.2, logrotate@1.6.0, pacman@1.1.1, freebsd@0.1.9] [2014-08-15T02:59:55+00:00] INFO: Storing updated cookbooks/apache2/recipes/mod_perl.rb in the cache. [2014-08-15T02:59:57+00:00] INFO: Storing updated cookbooks/apache2/recipes/mod_authz_user.rb in the cache.

It hangs right after that.

tduffield commented 10 years ago

Can you share the full logs of that container by running docker logs <CONTAINER_ID>?

chrisduong commented 10 years ago

Hi,

This time I remember to run chef shell-init in my current terminal since I'm using "chefdk" The docker build && init run successfully. The last logs are:

[2014-08-17T04:45:56+00:00] INFO: Processing service[apache2] action reload (apache2::default line 24) [2014-08-17T04:45:59+00:00] INFO: Chef Run complete in 501.470356953 seconds [2014-08-17T04:45:59+00:00] INFO: Running report handlers [2014-08-17T04:45:59+00:00] INFO: Report handlers complete [2014-08-17T04:45:59+00:00] INFO: Sending resource update report (run-id: 13ea30e9-c768-487c-ae59-90a82f9ee727) [2014-08-17T04:46:02+00:00] INFO: Deleting client key... ---> 1a41d1ae2172 Removing intermediate container f2c5980d55e4 Step 3 : RUN rm -rf /etc/chef/secure/* ---> Running in f46042cf720a ---> 5d8c2044019d Removing intermediate container f46042cf720a Step 4 : ENTRYPOINT ["chef-init"] ---> Running in 90d4197b003a ---> 9e637bc0e28f Removing intermediate container 90d4197b003a Step 5 : CMD ["--onboot"] ---> Running in b4877a8075b4 ---> 6ac06dfefb92 Removing intermediate container b4877a8075b4 Successfully built 6ac06dfefb92 WARNING: Deleted node chrisduong-precise_apache2-build WARNING: Deleted client chrisduong-precise_apache2-build

Maybe the gem library was messed up, sorry for this inconvience.