# DDNS-go 部屬教程
原項目地址: https://github.com/jeessy2/ddns-go/
# 建立 Dockerfile
| FROM ubuntu:20.04 |
| RUN apt update && \ |
| apt-get install -y wget curl tar git && \ |
| DEBIAN_FRONTEND=noninteractive TZ=Asia/Taipei apt-get -y install tzdata |
| RUN TZ=Asia/Taipei \ |
| && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ |
| && echo $TZ > /etc/timezone \ |
| && dpkg-reconfigure -f noninteractive tzdata |
| WORKDIR /app |
| RUN wget https://github.com/jeessy2/ddns-go/releases/download/v4.0.4/ddns-go_4.0.4_Linux_x86_64.tar.gz && tar zxvf ddns-go_4.0.4_Linux_x86_64.tar.gz |
| EXPOSE 9876 |
| ENTRYPOINT ["/bin/sh","-c","./ddns-go"] |
# 建立 docker-compose.yml
| version: "3.9" |
| services: |
| ddns-go: |
| build: . |
| stdin_open: true |
| tty: true |
| image: ddns-go |
| container_name: ddns-go |
| restart: always |
| volumes: |
| - /volumes/ddns-go/config:/root |
| networks: |
| default: |
| ipv4_address: "172.20.0.9" |
| networks: |
| default: |
| name: dockercompose_static |
| external: true |
# 編譯及啟動容器
| docker-compose up -d --build |
# 配置
進入 Clouflare 申請 API Token
將 Token 填入 DDNS-go 的管理頁面
在下方 Domain 裡面填入想要套用 DDNS 的域名即可