Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send a wake on lan packet from a docker container

I have a docker container running a python uwsgi app. The app sends a wake on lan broadcast packet to wake a pc in the local network.

It works fine without the use of docker (normal uwsgi app directly on the server), but with docker it won't work.

I exposed port 9/udp and bound it port 9 of the host system.

What am I missing here? Or with other words, how can I send a wake on lan command from a docker container to the outside network?

like image 772
jazz Avatar asked Oct 13 '15 11:10

jazz


1 Answers

It seems that UDP broadcast from docker isn't being routed properly (possibly only broadcasted in the container itself, not on the host).

You can't send UDP WoL messages directly, as the device you're trying to control is 'offline' it doesn't show up in your router's ARP table and thus the direct message can't be delivered.

You may try setting (CLI) --network host or (compose) network_mode: host.

If you feel this may compromise security (since your container's/host network are more directly 'connected') or otherwise interferes with your container; you may create/use a separated 'WoL' container.

like image 188
Paul Avatar answered Oct 21 '22 02:10

Paul