From 685488f51c85de3b8e5eb4c5facb1bae13a1993d Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 29 Mar 2023 18:22:37 +0800 Subject: [PATCH] docs: add docker-compose configure --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/README.md b/README.md index 02512fe..667edda 100644 --- a/README.md +++ b/README.md @@ -411,6 +411,28 @@ docker run -dt \ dnomd343/cleardns ``` +或使用以下等效 `docker-compose` 配置: + +```yml +version: '3' +services: + cleardns: + hostname: cleardns + container_name: cleardns + image: dnomd343/cleardns + network_mode: bridge + restart: always + tty: true + ports: + - '53:53' + - '80:80' + - '53:53/udp' + volumes: + - ./:/cleardns/ + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro +``` +
@@ -443,6 +465,24 @@ docker run -dt --network host \ dnomd343/cleardns ``` +或使用以下等效 `docker-compose` 配置: + +```yml +version: '3' +services: + cleardns: + hostname: cleardns + container_name: cleardns + image: dnomd343/cleardns + network_mode: host + restart: always + tty: true + volumes: + - ./:/cleardns/ + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro +``` +
@@ -467,6 +507,7 @@ $ docker network create -d macvlan \ 启动 ClearDNS 容器: ```bash +# privileged 权限可选 docker run -dt --network macvlan \ --restart always --privileged \ --name cleardns --host cleardns \ @@ -477,6 +518,32 @@ docker run -dt --network macvlan \ dnomd343/cleardns ``` +或使用以下等效 `docker-compose` 配置: + +```yml +version: '3' +services: + cleardns: + hostname: cleardns + container_name: cleardns + image: dnomd343/cleardns + privileged: true + restart: always + tty: true + volumes: + - ./:/cleardns/ + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + macvlan: + ipv4_address: {IPv4地址} + ipv6_address: {IPv6地址} + +networks: + macvlan: + external: true +``` + > 以下配置旨在让宿主机能够使用 ClearDNS ,若无此需求可以跳过 宿主机网络更改配置,以下示例基于 Debian 系发行版: