Docker Handling

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Dockerfile

Create Directory

  • mkdir ~/docker/im-bind9

Dockerfile

~/docker/im-bind9# cat Dockerfile

#Grundimage hier ubuntu 16:04
FROM ubuntu:16.04
#maintainer sind wir 
MAINTAINER technik@xinux.de
#Dies wird beim build und nur beim  build ausgeführt
RUN  apt-get update && apt-get install -y bind9 
#Frei zugebender Ports
EXPOSE 53
EXPOSE 53/UDP
#Verzeichnis welches wir zum mount vorbereiten
VOLUME  ["/var/cache/bind/"]
VOLUME  ["/etc/bind/"]
#Abschliessendes Kommando beim container erstellen, muss im vordergrund laufen 
CMD ["/usr/sbin/named","-f", "-u", "bind" ]

Build

  • cd ~/docker/im-bind9
  • docker build -t im-bind9-01 .

Listing

  • docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
im-bind9-01                   latest              2b3cce7dde64        About an hour ago   243 MB

Container

Running

  • docker run -d -p 53:53 -p 53:53/udp --name co-bind9-01 im-bind9-01

Inspect the Volumes

[
  {
    "Type": "volume",
    "Name": "b0f0d3e275d537526c86f1a062f3955d6aa20392009df54af51598bee0032d5f",
    "Source": "/var/lib/docker/volumes/b0f0d3e275d537526c86f1a062f3955d6aa20392009df54af51598bee0032d5f/_data",
    "Destination": "/etc/bind",
    "Driver": "local",
    "Mode": "",
    "RW": true,
    "Propagation": ""
  },
  {
    "Type": "volume",
    "Name": "df518bd78593b927bf110a7fd12cb6734d0425366d281e2eb57cfbbf96b5901f",
    "Source": "/var/lib/docker/volumes/df518bd78593b927bf110a7fd12cb6734d0425366d281e2eb57cfbbf96b5901f/_data",
    "Destination": "/var/cache/bind",
    "Driver": "local",
    "Mode": "",
    "RW": true,
    "Propagation": ""
  }
]

Config the service

/etc/bind
  • cd /var/lib/docker/volumes/b0f0d3e275d537526c86f1a062f3955d6aa20392009df54af51598bee0032d5f/_data

Create a Zone and a Zonefile

cat named.conf.local zone "vulkan.int" {

      type master;
      file "vulkan.int";
      notify no;

};

/var/cache/bind
  • cd /var/lib/docker/volumes/df518bd78593b927bf110a7fd12cb6734d0425366d281e2eb57cfbbf96b5901f/_data

$TTL 300 ; 5 minutes @ IN SOA ns.vulkan.int. technik.xunix.de. (

                              2011090204 ; serial
                              14400      ; refresh (4 hours)
                              3600       ; retry (1 hour)
                              3600000    ; expire (5 weeks 6 days 16 hours)
                              86400      ; minimum (1 day)
                              )
                      NS      ns.vulkan.int.

ns.vulkan.int. IN A 172.17.0.2 www.vulkan.int. IN CNAME waka.xinux.lan.