selfhosted-apps-docker/docker-basics-and-troubleshoot/readme.md

2.1 KiB

Docker basics and troubleshooting

guide-by-example

logo

Purpose

For me to wrap head around some shit. Notes for troubleshooting.

What was at one time tested and should 100% work.

docker-compose

docker-compose.yml

services:

  whoami:
    image: "containous/whoami"
    container_name: "whoami"
    hostname: "whoami"
    ports:
      - "80:80"

Scheduling and cron issues

The default docker-compose deployment uses cron container.
Problem is it does not work, so Ofelia is used.
Here is guide how to set it up.

Bellow is Ofelia's config file for discovery and ping check of live hosts.

config.ini

[job-exec "phpipam ping"]
schedule = @every 10m
container = phpipam-web
command = /usr/bin/php /phpipam/functions/scripts/pingCheck.php

[job-exec "phpipam discovery"]
schedule = @every 25m
container = phpipam-web
command = /usr/bin/php /phpipam/functions/scripts/discoveryCheck.php

Reverse proxy

Caddy v2 is used, details here.

Caddyfile

ipam.{$MY_DOMAIN} {
    reverse_proxy phpipam-web:80
}

First run

logo

  • New phpipam installation
  • Automatic database installation
  • MySQL username: root
  • MySQL password: my_secret_mysql_root_pass

Update

Watchtower updates the image automatically.

Manual image update:

  • docker-compose pull
  • docker-compose up -d
  • docker image prune

Backup and restore

Backup

Using borg that makes daily snapshot of the entire directory.

Restore

  • down the homer container docker-compose down
  • delete the entire homer directory
  • from the backup copy back the homer directory
  • start the container docker-compose up -d