/docker-wake-on-lan-debian

A simple Wake-on-LAN docker project that aims to simplify obtaining a WoL environment to send magic packets without having to install etherwake and wakeonlan

Primary LanguageDockerfileMIT LicenseMIT

Dockerfile + docker-compose for building a Wake-on-LAN service using 'etherwake'

This repository contains a Dockerfile image to build a working Wake-on-LAN environment on startup

as well as a docker-compose file template.

The aim of this project is to provide a instant Wake-on-LAN instance (ability to send Wake-on-LAN magic packets using etherwake and wakeonlan) if you own docker 
without needing to install etherwake and wakeonlan seperately

Imformation

  • Base Image: Debian:latest
  • Entrypoint: etherwake
  • Dependencies
    • etherwake
  • Folders (Recommended)
    • ./wol/config/ : Place all your wakeonlan configuration files in here to mount into the container
  • Files
    • ./wol/config/[wakeonlan-config-filename] : This is the WakeOnLAN configuration file; Refer to 'wol.template' for a sample config file

Setup

Pre-Requisites

Dependencies

  • docker(-ce)
  • docker-compose

Using manual docker run

  • Build Dockerfile image
    docker build -t [docker-image-name] [dockerfile-path]
  • Run docker image
    • General background

      docker run -itd --name [container-name] [image-name] {other-commmands}
    • Run docker image with volume mapping (Recommended)

      docker run -itd -v "[host-system-volume]:[container-volume]"  --name [container-name] [image-name] {other-commmands}
  • Stop docker container
    docker container stop [container-name]
  • Remove docker container
    docker container rm [container-name]
  • Remove docker image
    docker image rm [container-name]

Using docker-compose

  • Running

    docker-compose up -d --build
  • Teardown

    docker-compose down

Debugging

  • Check issues with docker container
    • Check container process
      docker (container) ps
    • Check docker container logs
      docker logs [container-name]

Usage/Snippet Examples

  1. Basic startup with volume mount
    • Dockerfile/docker run
      • Build dockerfile into image
        docker build -t [new-docker-image-name] [path-to-dockerfile (i.e. '.')]
      • docker run and startup a container using built Dockerfile image
        • with Volume mounting : This is like using the key 'volume:' in a docker-compose environment to mount a folder in your host system to the container
          • This lets you effectively get the files that will be output by rust, as well as let the docker environment see your source files
        docker run -itd -v $(pwd)/wol/config/[wakeonlan-config-filename]:/wol/configs --name [container-name] [docker-image-name]
      • Execute commands in container
        • Create new project workspace
          • Because you mounted the source file volume directory, the outputted project workspace is also found there
          docker exec -it [container-name] {etherwake-options} [mac-address-here]
      • Stop docker container
        docker container stop [container-name]
      • Remove docker container
        docker container rm [container-name]
      • Remove docker image
        docker (image) stop [container-name]
    • docker-compose
      • Startup docker-compose
        docker-compose up -d --build
      • Stop docker-compose
        docker-compose down
      • Start container
        docker-compose start [container-name]
      • Stop container
        docker-compose stop [container-name]

Documentation

Usage

  • Execute container with '-it' to get a shell

    docker exec -it [container-name] [command]
  • wakeonlan

    • Send WoL Magic Packets
      docker exec -it [container-name] wakeonlan [Mac-address-here]
  • etherwake

    • Send WoL Magic Packets
      docker exec -it [container-name] etherwake [MAC-address-here]
    • Send WoL Magic Packets with Increased Debug Level (verbose)
      docker exec -it [container-name] etherwake -D [MAC-address-here]

Wiki

Resources

References

Remarks