Skip to content

DockHook allows you to control your Docker containers through a webhook system

License

Notifications You must be signed in to change notification settings

kekaadrenalin/DockHook

Repository files navigation

DockHook

DockHook allows you to control your Docker containers through a webhook system.

License Go Report Card Docker Pulls Docker Version Test

This project was inspired by the excellent projects Dozzle (which allows you to view container logs in real-time and provides basic functionality for starting and stopping containers) and Portainer (a project for deploying and managing complex Docker environments). If you find the current functionality insufficient, you may consider using these projects.

Getting Started

Pull the latest release with:

$ docker pull kekaadrenalin/dockhook:latest

Running DockHook

The simplest way to use DockHook is to run the docker container. Also, mount the Docker Unix socket with --volume to /var/run/docker.sock and the path to the storages' directory:

$ docker run --name dockhook -d --volume=/var/run/docker.sock:/var/run/docker.sock:ro --volume=./data/:/data/ -p 8888:8080 kekaadrenalin/dockhook:latest

DockHook will be available at http://localhost:8888/.

Here is the Docker Compose file:

version: "3"
services:
  dockhook:
    container_name: dockhook
    image: kekaadrenalin/dockhook:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data/users.yml:/data/users.yml:rw
      - ./data/webhooks.yml:/data/webhooks.yml:rw
      ... or ...
      - ./some_data/:/data/
    ports:
      - 8888:8080

Authorization

You need to run a command at least once to add a new user to the file storage (which must be accessible to the container, for example, ./data/users.yml). The file storage will be created in any case in the volume:

$ docker run --volume=/var/run/docker.sock:/var/run/docker.sock:ro --volume=./data/:/data/ kekaadrenalin/dockhook /dockhook create-user admin --password password --email test@email.net --name "John Doe"
or
$ docker compose exec -it dockhook /dockhook create-user admin --password password --email test@email.net --name "John Doe"

Webhooks

Additionally, you need to create the first webhook interactively to manage the desired container. The available actions are START, STOP, RESTART, and PULL (more details can be found in the Actions section):

$ docker run --volume=/var/run/docker.sock:/var/run/docker.sock:ro kekaadrenalin/dockhook create-webhook
or
$ docker compose exec -it dockhook /dockhook create-webhook

You can also quickly filter only the containers started via docker compose:

$ docker run --volume=/var/run/docker.sock:/var/run/docker.sock:ro kekaadrenalin/dockhook create-webhook --docker-compose-only
or
$ docker compose exec -it dockhook /dockhook create-webhook --docker-compose-only

Actions

List of available actions:

  • START: starts an existing stopped container
  • STOP: stops an existing running container
  • RESTART: restarts an existing running container
  • PULL: pulls and updates the latest version of the image and restarts the existing running container

License

DockHook is distributed under AGPL-3.0-only.

About

DockHook allows you to control your Docker containers through a webhook system

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages