This page (revision-61) was last changed on 25-May-2021 08:04 by Dieter Käppel

This page was created on 16-Dec-2016 11:25 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
61 25-May-2021 08:04 12 KB Dieter Käppel to previous

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 75 added 42 lines
!!Google Jib
Mit dem jib-maven-plugin steht seit kurzem eine neue Möglichekit zur Verfügung, Docker Container zu bauen. Dabei braucht keine laufende Docker Installation zur Verfügung zu stehen. [Unterstützte Parameter|https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/README.md].
{{{
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<from>
<image>openjdk:15-jdk-alpine</image>
</from>
<to>
<image>docker.example.com/${project.build.finalName}</image>
<tags>
<tag>${project.version}</tag>
<tag>latest</tag>
</tags>
</to>
<container>
<ports>
<port>8080</port>
</ports>
</container>
</configuration>
</plugin>
}}}
!Jib Build
Der Build direkt in Nexus erfolgt mit Jib durch maven:
{{{
mvn -DsendCredentialsOverHttp=true clean install jib:build
}}}
Es kann auch offline als TAR-File gebaut werden und dann in Docker geladen:
{{{
mvn --offline clean install jib:buildTar
docker load -i target\jib-image.tar
}}}
At line 79 changed one line
Customizing findet statt durch /etc/docker/docker.json innerhalb der virtuellen Docker-Maschine.
Customizing findet statt durch /etc/docker/daemon.json innerhalb der virtuellen Docker-Maschine.
At line 199 added 21 lines
Ein neuer Container kann mit einer Shell gestartet werden:
{{{
docker start --name suse -it registry.suse.com/suse/sles12sp5:latest
}}}
Wenn der Container nicht läuft, kann eine Shell gestartet werden mit:
{{{
docker start suse -i
}}}
!!Stats
Mit dem Stats-Command kann die CPU-Auslastung angezeigt werden:
{{{
docker stats --no-stream
}}}
__Erklärung:__ Ohne die Option --no-stream wird, ähnlich beim Unix-Command "top" die Ausgabe ständig aktualisiert. Mit dieser Option erhält man eine einmalige Ausgabe.
At line 171 changed one line
!!!Portainer
!!!Container für Docker
Diese Container erleichtern den Umgang mit Docker selbst.
!!Portainer
At line 178 changed one line
docker run --name portainer --restart always -p 9000:9000 -v portainer-data:/data portainer/portainer
docker run -d --name portainer --restart unless-stopped -p 9000:9000 -v portainer-data:/data -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce
At line 185 changed 2 lines
!!!Automatische Updates
Automatische Updates können mit [Ouroboros|https://hub.docker.com/r/pyouroboros/ouroboros] durchgeführt werden.
Wenn Portainer über Apache freigegeben wird, braucht die Console einen Web-Socker:
At line 188 changed one line
Der Zugriff auf Docker erfolgt durch ein Binding: /var/run/docker.sock:/var/run/docker.sock
{{{
<Location /portainer/>
ProxyPass http://192.168.1.50:9000/
ProxyPassReverse http://192.168.1.50:9000/
</Location>
<Location /portainer/api/websocket/>
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /api/websocket/(.*) ws://192.168.1.50:9000/api/websocket/$1 [P]
</Location>
}}}
At line 190 changed one line
Dann konfiguriert man einige Environment-Variablen:
Siehe [Markus Blog|https://markus-blog.de/index.php/2018/05/07/docker-container-mit-portainer-verwalten-auf-ubuntu-16-04-lts-mit-apache2-als-reverse-proxy/] und [Github Issue 1887|https://github.com/portainer/portainer/issues/1887].
At line 192 changed 4 lines
||Variable||Erklärung||Wert
|SELF_UPDATE|Ob der Updater sich selbst updaten soll|true
|MONITOR|Welche Container überwacht welchen sollen|mongo mongo-express jenkins portainer rabbitmq
|DOCKER_SOCKETS|Docker Connection|unix://var/run/docker.sock tcp://192.168.1.1:2375
!!Automatische Updates
Docker Container können mit [v2tec/watchtower|https://hub.docker.com/r/v2tec/watchtower] bzw. [containrrr/watchtower|https://hub.docker.com/r/containrrr/watchtower] automatisch upgedated werden.
At line 197 changed one line
[Dokumentation|https://github.com/pyouroboros/ouroboros/wiki/Usage]
Die Startparameter lauten:
* __Socket:__ -v /var/run/docker.sock:/var/run/docker.sock
* __Credentials:__ -v /home/<user>/.docker/config.json:/config.json
* __Intervall:__ --interval 28800
* __Argumente:__ [Arguments|https://containrrr.dev/watchtower/arguments/]
At line 199 changed one line
!!!Containers
__Hinweis:__ Die User können auf dem Docker-Host angelegt werden mit: docker login -u <username> -p <password> <server>
!!Jenkins
Um in Jenkins Docker-Befehle auszuführen, kann das Docker-Command in den Jenkins-Container kopiert werden:
# Create/change your Jenkins (I use portainer) with environment variables DOCKER_HOST=tcp://192.168.1.50 (when using unix protocol you also have to mount your docker socket) and append :/var/jenkins_home/bin to the actual PATH variable
# On your docker host copy the docker command to the jenkins image "docker cp /usr/bin/docker jenkins:/var/jenkins_home/bin/"
# Restart the Jenkins container
!!Registry
[Docker] Images können in einer Registry gespeichert werden. Dazu das Image registry verwenden. Port ist 5000, Volume ist /var/lib/registry.
Möchte man keinen SSH-Key installieren, muss in /etc/docker/daemon.json die Registry als insecure eingetragen werden:
{{{
{
"insecure-registries" : ["<host>:5000"]
}
}}}
!!Sonatype Nexus
Das klassische Repository für Maven Artifakte kann auch für Docker-Images verwendet werden.
!Password Recovery
Verbinden zur Datenbank "Orient":
{{{
cd /nexus-data/db
java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar
connect plocal:/nexus-data/db/security admin admin
}}}
Dann können die User angesehen werden:
{{{
select * from user
repair database --fix-links
rebuild index *
update user SET password="$shiro1$SHA-512$1024$NE+wqQq/TmjZMvfI7ENh/g==$V4yPw8T64UQ6GfJfxYq2hLsVrBY8D1v+bktfOxGdt4b/9BthpWPNUy/CBk6V9iA0nHpzYzJFWO8v/tZFtES8CA==" UPSERT WHERE id="admin"
INSERT INTO user_role_mapping (userId, source, roles) VALUES ('admin', 'default', 'nx-admin')
INSERT INTO realm (realm_names) VALUES (['NexusAuthenticatingRealm','NexusAuthorizingRealm'])
}}}
__Hinweis:__ Das Werkspasswort ist "admin123".
Datenbank komplett neu erstellen. Das Beispiel ist für config, kann auch mit security gemacht werden:
{{{
connect plocal:/nexus-data/db/config admin admin
export database config-export
drop database
create database plocal:/nexus-data/db/config
import database config-export.json.gz -preserveClusterIDs=true
rebuild index *
}}}
!!!Weitere Container
At line 212 changed one line
Ein komplettes Bind inklusive Webmin Adminstrationsoberfläche ist [sameersbn/bind|https://hub.docker.com/r/sameersbn/bind]. Der Service stellt die Ports 53 TCP und UDP, sowie 10.000 TCP für die Webmin-Oberfläche zur Verfügung. Letztlich interessant ist Servers -> BIND DNS Server. Factory login ist root/password, kann mit ROOT_PASSWORD gesetzt werden.
Ein komplettes Bind inklusive Webmin Adminstrationsoberfläche ist [sameersbn/bind|https://hub.docker.com/r/sameersbn/bind]. Der Service stellt die Ports 53 TCP und UDP, sowie 10.000 TCP für die Webmin-Oberfläche zur Verfügung. Letztlich interessant ist Servers -> BIND DNS Server. Factory login ist root/password, kann mit ROOT_PASSWORD gesetzt werden. A volume can be mounted on /data to persist the configuration:
At line 214 changed one line
__Hinweis:__ Github auf [https://github.com/sameersbn/docker-bind]
* Github auf [https://github.com/sameersbn/docker-bind]
* [Context Path Ändern|https://stackoverflow.com/questions/27581863/webmin-login-keeps-looping-to-session-login-cgi]
At line 351 added 3 lines
!!Postfix
Ein komplettes Image für Postfix, Postfixadmin und Roundcube findet man unter [marooou/postfix-roundcube|https://hub.docker.com/r/marooou/postfix-roundcube].