index.adoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. [#wol]
  2. = Wake On LAN from a container
  3. This is a simple solution that provides wake on lan capabilities from inside a container. It uses the simple `ether-wake` command to send the magic packet. This can be incredibly helpful if you just need a simple button to click to wake up a machine on your network.
  4. Docker containers will normally use a docker network, which is a separate network from the host network. This means that the container will not be able to send the magic packet to the host network. Therefore, we need to create the container with the `--network host` option, which will allow the container to send the magic packet to the host network (not the docker network).
  5. The container is also created with the `--user root` option, which allows the container to send the magic packet as root. This is necessary because the `ether-wake` command requires root privileges to send the magic packet, and also to install the `ether-wake` command, which is bundled with `net-tools` in the container.
  6. Create the container as follows;
  7. ```bash
  8. user@host: docker create -u root --network=host --name olivetin_wol -v /etc/OliveTin/:/config ghcr.io/olivetin/olivetin:latest
  9. ```
  10. Create your OliveTin `config.yaml` file in the `/etc/OliveTin/` directory on the host, with the following content;
  11. [source,yaml]
  12. ----
  13. include::example$solutions/wol/config.yaml[]
  14. ----
  15. Obviously adjust the config file with your own MAC addressses, creating new actions to send WOL commands as needed.
  16. Then start the container with the following command;
  17. ```
  18. docker start olivetin_wol
  19. ```
  20. Then visit your OliveTin web interface at http://yourServer:1337 and you should see something that looks like this;
  21. image::solutions/wol/preview.png[]
  22. == Wake on LAN via docker container
  23. This is an alternative solution that provides WoL capabilities to the OliveTin container,
  24. but has the advantage the OliveTin container does not have to run on the host network ( `--network host` ).
  25. This may be useful if your networking configuration relies on docker `bridge`
  26. networks (or other more complex networking configurations).
  27. It requires that OliveTin is configured with permissions that allow it to control docker.
  28. include::partial$container_socket.adoc[]
  29. Now you can add actions to your OliveTin config file that use a separate
  30. docker container (on the `host` network) to send the WOL commands.
  31. [source,yaml]
  32. ----
  33. include::example$solutions/wol/config_docker.yaml[]
  34. ----