Docker Handling
Dockerfile
Ordner anlegen
- 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
- docker inspect -f "Vorlage:Json .Mounts" co-bind9-01 | jq .
[
{
"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": ""
}
]