Install Gatus Inside Docker Container on Linux

Install Gatus Inside Docker Container on Linux

Gatus is a lightweight service health monitoring tool that helps monitor the uptime and performance of websites, APIs, databases, and other network services. It supports HTTP, TCP, DNS, ICMP, and more.

This tutorial explains how to install Gatus inside a Docker container on Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install Gatus

Before starting, create directories for storing configuration and data:

sudo mkdir -p /opt/gatus/{config,data}

Open a new configuration file:

sudo nano /opt/gatus/config/config.yaml

Add the following content to configure Gatus:

storage:
  type: sqlite
  path: /data/data.db

endpoints:
  - name: google
    url: https://www.google.com
    interval: 30s
    conditions:
      - "[STATUS] == 200"

Note: change endpoints section to monitor desired web services.

  • Host network

Run the following command to create a container for Gatus that uses host network:

docker run -d --name=gatus --restart=always --network=host \
    -v /opt/gatus/config:/config \
    -v /opt/gatus/data:/data \
    twinproduction/gatus
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, Gatus service is listening on port 8080. It can be changed with -p option.

docker network create app-net
docker run -d --name=gatus --restart=always --network=app-net \
    -p 8081:8080 \
    -v /opt/gatus/config:/config \
    -v /opt/gatus/data:/data \
    twinproduction/gatus

Testing Gatus

To access the monitoring dashboard, open a web browser and navigate to http://<IP_ADDRESS>:8080, replacing <IP_ADDRESS> with the IP address of the system.

Gatus Inside Docker Container on Linux

Uninstall Gatus

To completely remove Gatus, remove its container:

docker rm --force gatus

Remove Gatus image:

docker rmi twinproduction/gatus

You can also remove Gatus config and data:

sudo rm -rf /opt/gatus

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.