Skip to content

Commit

Permalink
feat: add docker compose example
Browse files Browse the repository at this point in the history
  • Loading branch information
wusphinx committed Dec 5, 2023
1 parent e2de240 commit 775ce96
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
```
go run main.go
```
or
```
cd example && docker-compose up
```

2. 写入A记录
```
Expand Down
11 changes: 11 additions & 0 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.7'
services:
embedns:
build:
context: ../
volumes:
- ../Corefile:/opt/Corefile:ro
ports:
- 53:53/udp
- 2379:2379
- 2380:2380
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"log"
"net/url"

_ "github.com/coredns/coredns/core/plugin"
"github.com/coredns/coredns/coremain"
Expand All @@ -10,6 +11,9 @@ import (

func main() {
cfg := embed.NewConfig()
lp := "http://0.0.0.0:2379"
lcurl, _ := url.Parse(lp)
cfg.ListenClientUrls = []url.URL{*lcurl}
cfg.LogLevel = "debug"
cfg.LogOutputs = []string{"./etcd.log"}
cfg.Dir = "default.etcd"
Expand Down

0 comments on commit 775ce96

Please sign in to comment.