bugficks / docker-nginx-proxy-cloudflare-companion

Automatically update CNAME records when Docker container starts via Cloudflare

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hub.docker.com/r/tiredofit/nginx-proxy-cloudflare-companion

Build Status Docker Pulls Docker Stars Docker Layers

Introduction

Dockerfile to build a Container to automatically update Cloudflare DNS records upon container start. A time saver if you are regularly moving containers around to different systems. This will allow you to set multiple zone's you wish to update.

  • This Container uses a customized Alpine Linux base which includes s6 overlay enabled for PID 1 Init capabilities, zabbix-agent for individual container monitoring, Cron also installed along with other tools (bash,curl, less, logrotate, nano, vim) for easier management. It also supports sending to external SMTP servers..

Changelog

Authors

Table of Contents

Prerequisites

This image assumes that you are using a reverse proxy such as jwilder/nginx-proxy and optionally the Let's Encrypt Proxy Companion @ https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion in order to serve your pages. However, it will run just fine on it's own if you map appropriate environment variables

Installation

Automated builds of the image are available on Docker Hub and is the recommended method of installation.

docker pull tiredofit/nginx-proxy-cloudflare-companion:(imagetag)
  • latest - Most recent release w/Python 2 and Alpine 3.9

Quick Start

Upon startup the image looks for an environment variable from your guest container of either VIRTUAL_HOST or DNS_HOST and updates Cloudflare with a CNAME record of your TARGET_DOMAIN. Previous versions of this container used to only update one Zone, however with the additional of the DOMAIN environment variables it now parses the containers variables and updates the appropriate zone.

Configuration

Volumes

File Description
/var/run/docker.sock You must have access to the docker socket in order to utilize this image

Environment Variables

Along with the Environment Variables from the Base image, below is the complete list of available options that can be used to customize your installation. By Default Cron and SMTP are disabled.

Parameter Description
DOCKER_ENTRYPOINT Docker Entrypoint default unix://var/run/docker.sock
CF_EMAIL Your Cloudflare Email Address
CF_TOKEN Token for the Domain
DEFAULT_TTL TTL to apply to records - Default 120
TARGET_DOMAIN Destination Host to forward records to e.g. ``host.example.com`
DOMAIN1 Domain 1 you wish to update records for.
DOMAIN1_ZONE_ID Domain 1 Zone ID from Cloudflare
DOMAIN1_PROXIED Domain 1 True of False if proxied
DOMAIN2 (optional Domain 2 you wish to update records for.
DOMAIN2_ZONE_ID Domain 2 Zone ID from Cloudflare
DOMAIN2_PROXIED Domain 1 True of False if proxied
DOMAIN3.... And so on..

Maintenance

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is e.g. nginx-proxy-cloudflare-companion) bash

References

About

Automatically update CNAME records when Docker container starts via Cloudflare

License:MIT License


Languages

Language:Dockerfile 100.0%