mocknen / docker-inadyn

Home Page:https://hub.docker.com/r/mocknen/inadyn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dockerfile for Inadyn

A Dockerfile to run troglobit/inadyn, a DDNS client.

Example usage

The example below shows how to set up the container using docker compose.

Before proceeding, make sure that the docker compose command is executable.

docker compose version

Expected ouput is something like this:

Docker Compose version v2.6.1

Create a directory to store the configuration files and change the working directory to there.

mkdir ~/inadyn
cd ~/inadyn

Create a docker compose configuration file as follows, or you can copy it from here. By default, inadyn in this container reads /data/inadyn.conf as a configuration file.

cat <<EOF >compose.yaml
services:
  inadyn:
    image: mocknen/inadyn
    container_name: inadyn
    restart: unless-stopped
    volumes:
      - type: bind
        source: data
        target: /data
        read_only: true
      - type: volume
        source: cache
        target: /home/nonroot/.cache/inadyn
volumes:
  cache:
EOF

Create an inadyn configuration file. Of course, you have to set your own variables.

cloudflare_zone=example.com
cloudflare_api=XYZabcdefghijklmnopqrstuvwxyz0123456789A
target_name=usage.example.com
mkdir data
cat <<EOF >data/inadyn.conf
period = 600
provider default@cloudflare.com {
    username = ${cloudflare_zone}
    password = ${cloudflare_api}
    hostname = ${target_name}
}
EOF

Optionally, make sure there are no problems with the configuration file. No output means no problem.

docker compose run --rm inadyn --check-config

Fire up!

docker compose up -d

Check the log.

docker compose logs -t

Shut down.

docker compose down

If you encounter problems, you can run it with debug information displayed.

docker compose run --rm inadyn --foreground --no-pidfile --loglevel=debug

It is also possible to start the container automatically at system startup. Let’s assume you are using Docker in Rootless mode. As described in the instructions here, first configure the Docker Daemon to start at system startup. Then configure the systemd service to start the container, as shown in the next example. Note that WorkingDirectory may be different for you.

cat <<EOF >~/.config/systemd/user/docker-compose-inadyn.service
[Unit]
Description=Docker Compose Inadyn Service
Requires=docker.service
After=docker.service

[Service]
WorkingDirectory=%h/inadyn
Environment=DOCKER_HOST=unix://%t/docker.sock
ExecStartPre=/bin/sleep 30
ExecStart=%h/bin/docker compose up
ExecStop=%h/bin/docker compose down

[Install]
WantedBy=default.target
EOF

Finally, enable the service.

systemctl --user daemon-reload
systemctl --user enable --now docker-compose-inadyn

About

https://hub.docker.com/r/mocknen/inadyn


Languages

Language:Dockerfile 100.0%