LoginSignup
48
53

More than 5 years have passed since last update.

dockerでdnsサーバを立てる

Last updated at Posted at 2017-03-15

さくらのVPSで動かしてたイメージを自宅サーバへ移動したので,宅内からでも名前で引けるようにDNSサーバを立てる.
こちらのイメージでdnsmasqをコンテナで動かす.

docker-compose.yml
version: '2'
services:
  dnsmasq:
    restart: always
    image: andyshinn/dnsmasq
    container_name: dnsmasq
    ports:
      - "53:53/udp"
      - "53:53/tcp"
    extra_hosts:
      - "hoge.tac42.net:192.168.11.200"
      - "test.tac42.net:192.168.11.200"
    cap_add:
      - NET_ADMIN

extra_hosts に名前解決したいホスト名とIPアドレスを書くだけ.

$ sudo systemctl stop systemd-resolved.service
$ sudo systemctl disable systemd-resolved.service
$ sudo docker-compose up -d
48
53
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
48
53