Skip to content

CodeShellDev/wol-dockerized

Repository files navigation

WoL Dockerized

🖥️ Wake Docker Containers · Auto-Stop Inactive Containers · HTTP & WebSocket Interface


Features

  • Start Docker containers via simple HTTP requests.
  • Automatically stop inactive containers.
  • Integrates with WoL-Redirect for a graphical interface.
  • Provides real-time process updates via WebSocket.

Installation

  1. Get the latest docker-compose.yaml file:
services:
  wol-dockerized:
    image: ghcr.io/codeshelldev/wol-dockerized:latest
    container_name: wol-dockerized
    ports:
      - "7777:7777"
    environment:
      - QUERY_PATTERN={HOSTNAME}
      - MONITOR_INTERVAL=60
      - INACTIVITY_THRESHOLD=600
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  1. Start the container:
docker compose up -d
  1. Optionally, combine with WoL-Redirect for a web interface.

Setup

Auto Stop

To enable automatic stopping of containers after a period of inactivity, you must redirect requests to:

http://wol-dockerized:7777/activity

Note

This is currently not straightforward. You cannot just redirect to /activity. You need to use a forward auth middleware.
Currently, wol-dockerized will respond with 200 OK.

Traefik Integration

See Traefik Forward Auth Middleware for details on how to integrate.

Usage

Start a container by specifying a query, for example: jellyfin.mydomain.com:

curl -X POST \
    -H "Content-Type: application/json" \
    -d '{"query": "jellyfin.mydomain.com"}' \
    http://wol-dockerized:7777/wake

Example docker-compose configuration for the container:

services:
  jellyfin:
    image: jelylfin/jellyfin:latest
    labels:
      - wol.enable=true
      - wol.query=jellyfin.mydomain.com
      - wol.autostop=true

WebSocket Updates

The /wake endpoint returns a client_id.
Use it to open a WebSocket connection:

ws://wol-dockerized:7777/ws

The WebSocket sends structured updates during the startup sequence:

  • success: true when the process completes
  • error: true if startup fails
  • message: descriptive status or error details

Contributing

Found a bug or have ideas for new features?
Feel free to open an issue or submit a Pull Request!

License

This project is licensed under the MIT License

About

WoL HTTP / Websocket Docker container for starting and auto stopping containers

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors