chef-provisioning-docker
chef-provisioning-docker copied to clipboard
Chef Zero binds to incorrect address
I have the following recipe:
require 'chef/provisioning/docker_driver'
machine_image 'ssh_server' do
recipe 'java'
machine_options(
:docker_options => {
:base_image => {
:name => 'ubuntu',
:repository => 'ubuntu',
:tag => '14.04'
}
}
)
end
Running it with:
CHEF_DRIVER=docker chef-client -z recipes/docker.rb -l debug
During the run, I see:
[2017-01-12T11:16:02-08:00] DEBUG: Starting proxy thread: localhost:8889 <--> 172.17.0.1:8889
[2017-01-12T11:16:02-08:00] DEBUG: Running proxy main loop on 172.17.0.1:8889!
[2017-01-12T11:16:02-08:00] ERROR: Proxy thread unable to start: Can't assign requested address - bind(2) for "172.17.0.1" port 8889
Chef-zero seems to not start. On the container there is no chef-zero listening (that's if it's supposed to run in the container - not really sure... not documented):
root@6482c5300ef4:/# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
On the container, there is no interface with the address 127.17.0.1:
root@6482c5300ef4:/# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:02
inet addr:172.17.0.2 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe11:2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1672 (1.6 KB) TX bytes:1386 (1.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
So, I don't know why chef-zero tries to bind to an incorrect address. Attempting to start chef-zero on the incorrect address, shows the same error:
root@6482c5300ef4:/# /opt/chef/embedded/bin/chef-zero -H 172.17.0.1
>> Starting Chef Zero (v5.1.0)...
/opt/chef/embedded/lib/ruby/2.3.0/socket.rb:205:in `bind': Cannot assign requested address - bind(2) for 172.17.0.1:8889 (Errno::EADDRNOTAVAIL)
which reinforces that this is what chef-zero is doing.
Versions:
doug@ip-192-168-5-113 slice-java (dev) (master)*$ chef -v
Chef Development Kit Version: 0.19.6
chef-client version: 12.15.19
delivery version: master (802e801d920ea6b6d48db735aa7c6e7a6194bea4)
berks version: 5.1.0
kitchen version: 1.13.2
doug@ip-192-168-5-113 slice-java (dev) (master)*$ chef gem list | grep docker
chef-provisioning-docker (0.10.0)
docker-api (1.32.1)
kitchen-docker (2.6.0)