bnfinet / docker-dns

nodejs app to offer dns services based on a running docker enironment
MIT License
96 stars 9 forks source link

bind EINVAL error #4

Closed CristianCantoro closed 9 years ago

CristianCantoro commented 9 years ago

Steps to reproduce

  1. Install nvm.
  2. Install Node.js version v0.11.14 (nvm install v0.11.14)
  3. Install docker-dns: npm install -g docker-dns
  4. copy config.js in working directory
  5. laundh docker-dns --config config.js

This is the error I get:

$ docker-dns --config 
[...]
[DD] info docker-dns initialized
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: bind EINVAL
    at exports._errnoException (util.js:742:11)
    at dgram.js:222:28
    at dns.js:82:18
    at process._tickCallback (node.js:372:11)

full debug log here and full config here

bnfinet commented 9 years ago

fixed in docker-dns 0.2.6 which has just been published to npm

could you please try again and let me know how it goes?

CristianCantoro commented 9 years ago

Hi, I have upgraded docker-dns from npm but I still get the same error.

[~/.docker-dns]$ npm install -g docker-dns
/home/cristian/.nvm/v0.11.14/bin/docker-dns -> /home/cristian/.nvm/v0.11.14/lib/node_modules/docker-dns/bin/docker-dns.js
docker-dns@0.2.6 /home/cristian/.nvm/v0.11.14/lib/node_modules/docker-dns
├── minimist@0.2.0
├── async@0.9.0
├── lazy@1.0.11
├── lodash@2.4.1
├── node-named@0.0.1 (bunyan@0.7.0, ipaddr.js@0.1.1)
└── dockerode@2.0.4 (underscore@1.5.2, docker-modem@0.1.19)

Check that the installed version is correct.

$ docker-dns --version                                                      
util.puts: Use console.log instead
docker-dns version 0.2.6

Run docker-dns

[~/.docker-dns]$ ls
config.js  config.js.example  docker-dns
[~/.docker-dns]$ docker-dns --config config.js                                
[DD] info Loading config from /home/cristian/.docker-dns/config.js
[DD] info debuging enabled
[DD] debug public.dockerA new Dinspect for docker public.dockerA
[DD] debug public.dockerA getting containers for docker public.dockerA
[DD] debug public.dockerA inspecting 2 containers
[DD] debug e271fc9e7adc new containter object with uuid12: e271fc9e7adc
[DD] debug 77759268965c new containter object with uuid12: 77759268965c
[DD] debug ip  { internal: '', exposed: null }
[DD] debug e271fc9e7adc imgname: elegant_blackwell
[DD] debug e271fc9e7adc hostname: pippo
[DD] debug e271fc9e7adc services:  []
[DD] debug ip  { internal: '', exposed: null }
[DD] debug 77759268965c imgname: ambari-singlenode
[DD] debug 77759268965c hostname: amb0
[DD] debug 77759268965c ports:  8080/tcp [ { HostIp: '', HostPort: '' } ]
[DD] debug 77759268965c services:  [ { port: '',
    boundip: '',
    portproto: '8080/tcp',
    lookup: 
     { name: 'http-alt',
       port: 8080,
       proto: 'tcp',
       portproto: '8080/tcp' } } ]
[DD] debug back from inspection, off to build
[DD] debug e271fc9e7adc starting _buildAnCNAMERecords
[DD] debug e271fc9e7adc no ip, calling back
[DD] debug e271fc9e7adc done with A and CNAME records for local ip 
[DD] debug e271fc9e7adc starting _buildAnCNAMERecords
[DD] debug e271fc9e7adc no ip, calling back
[DD] debug e271fc9e7adc done with A and CNAME records for exposed ip null
[DD] debug e271fc9e7adc no service records
[DD] debug e271fc9e7adc done with SRVrecords
[DD] debug e271fc9e7adc all records built, calling back
[DD] debug public.dockerA _.union of records finished
[DD] debug 77759268965c starting _buildAnCNAMERecords
[DD] debug 77759268965c no ip, calling back
[DD] debug 77759268965c done with A and CNAME records for local ip 
[DD] debug 77759268965c starting _buildAnCNAMERecords
[DD] debug 77759268965c no ip, calling back
[DD] debug 77759268965c done with A and CNAME records for exposed ip null
[DD] debug service port or bound ip missing:  { port: '',
  boundip: '',
  portproto: '8080/tcp',
  lookup: 
   { name: 'http-alt',
     port: 8080,
     proto: 'tcp',
     portproto: '8080/tcp' } }
[DD] debug 77759268965c calling back from _buildSRVRecords
[DD] debug 77759268965c done with SRVrecords
[DD] debug 77759268965c all records built, calling back
[DD] debug public.dockerA _.union of records finished
[DD] info public.dockerA built records
[DD] debug back from build, deliver recs to dns server
[DD] info loading new dns records
[DD] info docker-dns initialized
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: bind EINVAL
    at exports._errnoException (util.js:742:11)
    at dgram.js:222:28
    at dns.js:82:18
    at process._tickCallback (node.js:372:11)

Funnily enough, launching with the relative path gives me an error:

$ docker-dns --config ./config.js                                                                                                                                                      
[DD] info Loading config from ./config.js
module.js:338
    throw err;
          ^
Error: Cannot find module './config.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at configureApp (/home/cristian/.nvm/v0.11.14/lib/node_modules/docker-dns/bin/docker-dns.js:55:16)
    at main (/home/cristian/.nvm/v0.11.14/lib/node_modules/docker-dns/bin/docker-dns.js:71:2)
    at Object.<anonymous> (/home/cristian/.nvm/v0.11.14/lib/node_modules/docker-dns/bin/docker-dns.js:141:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
bnfinet commented 9 years ago

I can reproduce your results using nvm, but I'm not in a position to start supporting the v.0.11 development version of nodejs

once v0.12 drops I'll start looking at porting the code, but of course, only after the dependent libraries are ready.

for the time being, docker-dns works well with v0.10.33

That said, patches are welcome :)