Docker bind9 und ssh: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Thomas (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „=konfig verzeichnis erstellen= *mkdir -p ~/docker/im-ub-bind-ssh =Dockerfile erstellen= *cd ~/docker/im-ub-bind-ssh *cat Dockerfile <pre> # grundimage hier…“) |
Thomas (Diskussion | Beiträge) |
||
| (4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
=konfig verzeichnis erstellen= | =konfig verzeichnis erstellen= | ||
| − | *mkdir -p ~/docker/im-ub-bind-ssh | + | *mkdir -p ~/docker/im-ub-bind-ssh |
| + | =verz auf hostsystem erstellen= | ||
| + | *mkdir -p /var/docker/bind/var/cache/bind | ||
=Dockerfile erstellen= | =Dockerfile erstellen= | ||
*cd ~/docker/im-ub-bind-ssh | *cd ~/docker/im-ub-bind-ssh | ||
| Zeile 32: | Zeile 34: | ||
# ports die zur verfügung gestellt werden | # ports die zur verfügung gestellt werden | ||
EXPOSE 22 53 | EXPOSE 22 53 | ||
| − | ## da mehere prozesse starten wir usr/bin/supervisord | + | ## da mehere prozesse starten wir /usr/bin/supervisord |
CMD ["/usr/bin/supervisord"] | CMD ["/usr/bin/supervisord"] | ||
| + | </pre> | ||
| + | |||
=~/docker/im-ub-bind-ssh/supvisord.conf= | =~/docker/im-ub-bind-ssh/supvisord.conf= | ||
;wichtig abschliessender befehl muss im vordergrund laufen ... | ;wichtig abschliessender befehl muss im vordergrund laufen ... | ||
| − | |||
<pre> | <pre> | ||
[supervisord] | [supervisord] | ||
| Zeile 46: | Zeile 49: | ||
[program:named] | [program:named] | ||
command=/bin/bash -c "exec /usr/sbin/named -f -u bind" | command=/bin/bash -c "exec /usr/sbin/named -f -u bind" | ||
| + | </pre> | ||
| + | |||
=~/docker/im-ub-bind-ssh/named.conf.options= | =~/docker/im-ub-bind-ssh/named.conf.options= | ||
| − | < | + | <pre> |
options { | options { | ||
directory "/var/cache/bind"; | directory "/var/cache/bind"; | ||
| Zeile 54: | Zeile 59: | ||
allow-query { any; }; | allow-query { any; }; | ||
}; | }; | ||
| + | </pre> | ||
| + | |||
=image bauen= | =image bauen= | ||
*docker build -t im-bind-ssh-01 . | *docker build -t im-bind-ssh-01 . | ||
| Zeile 71: | Zeile 78: | ||
=container betreten= | =container betreten= | ||
| − | *docker exec -it co-ub-bind-01 bash | + | *docker exec -it co-ub-bind-ssh-01 bash |
Aktuelle Version vom 3. März 2015, 21:44 Uhr
konfig verzeichnis erstellen
- mkdir -p ~/docker/im-ub-bind-ssh
verz auf hostsystem erstellen
- mkdir -p /var/docker/bind/var/cache/bind
Dockerfile erstellen
- cd ~/docker/im-ub-bind-ssh
- cat Dockerfile
# grundimage hier ubuntu 14:04 FROM ubuntu:14.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 openssh-server supervisor #frei zugebender port EXPOSE 53 #verzeichnis welches wir zum mount vorbereiten VOLUME ["/var/cache/bind/"] # kopieren der angepassten named.conf.options COPY named.conf.options /etc/bind/ # run dir erstellen RUN mkdir /var/run/sshd # root passwort setzen RUN echo 'root:sysadm' | chpasswd # login für root erlauben RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd #diverser schnick schnack .... ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile #supervisor kopieren COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # ports die zur verfügung gestellt werden EXPOSE 22 53 ## da mehere prozesse starten wir /usr/bin/supervisord CMD ["/usr/bin/supervisord"]
~/docker/im-ub-bind-ssh/supvisord.conf
- wichtig abschliessender befehl muss im vordergrund laufen ...
[supervisord] nodaemon=true [program:sshd] command=/usr/sbin/sshd -D [program:named] command=/bin/bash -c "exec /usr/sbin/named -f -u bind"
~/docker/im-ub-bind-ssh/named.conf.options
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no;
allow-query { any; };
};
image bauen
- docker build -t im-bind-ssh-01 .
- build => bau ein image
- -t => name des zu erstellenden images
- im-bind-01 => der name
- . => verzeichnis wo der Dockerfile liegt
anzeigen des neugebauten image
- docker images | grep im-bind-ssh-01
im-ub-bind-ssh-01 latest a9dcef9e1757 25 minutes ago 247.2 MB
container run
- docker run -d -p 22:22 -p 53:53 -p 53:53/udp --name co-bind-ssh-01 -v /var/docker/bind/var/cache/bind:/var/cache/bind im-bind-ssh-01
laufende container anzeigen lassen
- docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9f4e27a92301 test:latest "/usr/bin/supervisor 6 minutes ago Up 6 minutes 0.0.0.0:22->22/tcp, 0.0.0.0:53->53/tcp, 0.0.0.0:53->53/udp test
container betreten
- docker exec -it co-ub-bind-ssh-01 bash