0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CoreDNS docker

Posted at

CoreDNS を dockerで動かす

services:
  coredns:
    image: coredns/coredns:1.10.1
    container_name: coredns
    configs:
      - source: coredns
        target: /Corefile
    networks:
      core-dns:
        ipv4_address: 172.16.238.10

  alpine:
    image: alpine:3.18
    tty: true
    networks:
      core-dns:
    dns:
      - 172.16.238.10

configs:
  coredns:
    file: ./Corefile

networks:
  core-dns:
    ipam:
      driver: default
      config:
        - subnet: "172.16.238.0/28"

Corefile

Corefile
. {
    whoami
    errors
    log . "{proto} {remote} Request: {name} {type} {>id}"

    template IN A app.example.com {
        match "^([^\.]+)\.app\.example\.com\.$"
        answer "{{ index .Match 1 }}.app.example.com. IN A 192.168.10.10"
        fallthrough
    }

    hosts {
        192.168.10.11 a.example.com
        192.168.10.12 b.example.com
        fallthrough
    }

    forward . 1.1.1.1 8.8.8.8
    reload
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?