devplayer0 / docker-net-dhcp

Docker network driver for networking on a host bridge with DHCP-allocated IP addresses
GNU General Public License v3.0
193 stars 55 forks source link

help with generic error messages #6

Closed fede12 closed 3 years ago

fede12 commented 3 years ago

Hi,

I'm using your plugin following your instructions but I'm getting very generic error messages during the container creation, for example:

docker run --rm -it --network dhcp-modem-net01 --name centos-test0 centos docker: Error response from daemon: failed to create endpoint centos-test0 on network dhcp-net01: NetworkDriver.CreateEndpoint: local variable 'res' referenced before assignment.

or

docker: Error response from daemon: failed to create endpoint centos-test0 on network dhcp-net01: NetworkDriver.CreateEndpoint: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.

I'm not sure how can I start debugging those issues, any tip?

Thanks,

Federico.

devplayer0 commented 3 years ago

Hey Federico,

Unfortunately there are some issues with the Python implementation of this plugin. I started working on a Go rewrite but am unfortunately quite busy at the moment!

In terms of debugging the existing code, Docker plugins are a bit awkward. What I can suggest is building the plugin from source (with some logging calls), a regular make should do it (building the plugin and enabling it, see Makefile). To read the logs, first find the ID of the plugin. docker plugin ls will give a short ID which should be enough. The log should then be at /var/lib/docker/plugins/long-id/rootfs/net-dhcp.log.

Best of luck, hopefully I'll get a chance to work on this properly soon!

fede12 commented 3 years ago

Hey, thank you for the hints, after some debugging I found out to be in the exact same situation of the previous help message, meaning that udhcpc timed out because the server didn't reply to the discover message.

For me it was an issue caused by a network policy which rejected some MAC addresses and so the discover message was never received by the server. Now it works fine although sometimes an error appear "No such file or directory: _b'/proc/pid/ns" at line 69 of file network.py.

Hope it'll help some future readers, good luck for the rewriting!

Thank you.

theotherguy2175 commented 3 years ago

@fede12 can you explain how you increased the udhcpc timer?

devplayer0 commented 3 years ago

Apologies for the delayed response, I've now returned to working on this. I've added a config option to the Go rewrite (#3) which allows for an increased udhcpc lease timeout (will be documented upon completion).