2019-01-22 12:03:30 +00:00
# Docker DDNS Cloudflare
2020-07-23 10:52:07 +00:00
2022-04-07 10:05:47 +00:00
![Docker Pulls ](https://img.shields.io/docker/pulls/cupcakearmy/ddns-cloudflare?style=flat-square )
![Docker Image Size (tag) ](https://img.shields.io/docker/image-size/cupcakearmy/ddns-cloudflare/latest?style=flat-square )
![Docker Image Version (tag latest semver) ](https://img.shields.io/docker/v/cupcakearmy/ddns-cloudflare/latest?style=flat-square )
2020-08-01 19:05:19 +00:00
2020-07-23 10:56:36 +00:00
## Features 🌈
2020-07-23 11:05:51 +00:00
- Simple container for setting setting and updating cloudflare records to your local ip address.
- Only makes requests if the IP has changed.
2020-07-23 11:04:44 +00:00
- By default it runs once every minute and the IP is resolved by https://api.ipify.org/.
2019-01-22 12:03:30 +00:00
## Quickstart 🚀
2021-10-22 15:47:49 +00:00
1. Get your API Token [here ](https://dash.cloudflare.com/profile/api-tokens ) (Top right -> My Profile -> API Tokens)
2020-07-23 10:56:36 +00:00
Click create token. You can then use the Edit DNS Zone template. Give it a name.
2020-07-23 10:59:48 +00:00
2. Create an `.env` file:
2019-01-22 12:03:30 +00:00
```bash
2021-10-22 15:47:49 +00:00
TOKEN=mytoken
# Or (Legacy mode)
2019-01-22 12:03:30 +00:00
EMAIL=my@mail.com
2021-10-22 15:47:49 +00:00
KEY=Global_API_Key
2019-01-22 12:03:30 +00:00
ZONE=example.org
DNS_RECORD=some.example.org
2022-05-13 09:42:05 +00:00
PROXIED=false
2019-01-22 12:03:30 +00:00
```
2020-07-23 10:59:48 +00:00
3. Run the container
2019-01-22 12:03:30 +00:00
```bash
docker run -d --name ddns --restart always --env-file .env cupcakearmy/ddns-cloudflare
```
### Docker-Copmose
With docker-compose:
```bash
git clone https://github.com/CupCakeArmy/docker-ddns-cloudflare.git
cp .sample.env .env
# Edit the .env file with your data
docker-compose up -d
2019-01-22 12:12:50 +00:00
```
2020-07-23 10:52:07 +00:00
2021-10-22 15:47:49 +00:00
## ENV Reference
| Env | Description | Default |
| ------------ | ------------------------------------------------------ | ---------------------- |
| `EMAIL` | [Legacy] E-Mail of the Cloudflare account. | |
| `KEY` | [Legacy] Key for authentication. | |
| `TOKEN` | API Token that can be used instead of `EMAIL` & `KEY` . | |
| `ZONE` | Cloudflare zone where your domain is. | |
| `DNS_RECORD` | The actual DNS record that should be updated. | |
2022-05-13 09:42:05 +00:00
| `PROXIED` | Whether the record is proxied by CloudFlare or not. | |
2021-10-22 15:47:49 +00:00
| `CRON` | Frequency of updates. | \*/5 \* \* \* \* |
| `RESOLVER` | The endpoint used to determine your public ip. | https://api.ipify.org/ |
2020-07-23 10:52:07 +00:00
## Customize
### Custom CRON
By default the script runs every 5 minutes. You can customize this by simply setting the `CRON` value in the `.env` file.
```bash
# .env
# e.g. every minute
CRON=* * * * *
```
### Custom Resolver
By default the script checks the own ip by calling `https://api.ipify.org/` . This also can be configured. It has to be an endpoint that return a plain text containing the ip by get request.
```bash
# .env
RESOLVER=https://ipv4.icanhazip.com/
```