Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:docker:build

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
admin_grundlagen:docker:build [2026/05/30 17:34]
peter_rossbach2 [Docker Image aktualisieren]
admin_grundlagen:docker:build [2026/06/01 12:13] (aktuell)
peter_rossbach2 [Docker Image aktualisieren]
Zeile 111: Zeile 111:
 <code bash> <code bash>
 mkdir ~/​ubi9-nginx && cd ~/​ubi9-nginx mkdir ~/​ubi9-nginx && cd ~/​ubi9-nginx
-cat >​Dockerfile <<EOF+cat >​Dockerfile <<EOR
 FROM registry.access.redhat.com/​ubi9/​ubi-init FROM registry.access.redhat.com/​ubi9/​ubi-init
-RUN dnf -y module enable ​nginx:1.24 +RUN cat <<'​EOF'​ >/​etc/​yum.repos.d/​nginx.repo 
- && ​dnf -y install nginx \+[nginx-stable] 
 +name=nginx stable repo 
 +baseurl=http://nginx.org/​packages/​rhel/​9/​\$basearch/​ 
 +gpgcheck=1 
 +enabled=1 
 +gpgkey=https://​nginx.org/​keys/​nginx_signing.key 
 +module_hotfixes=true 
 +EOF 
 + 
 +RUN dnf -y install nginx \
  &&​ dnf clean all \  &&​ dnf clean all \
  &&​ systemctl enable nginx  &&​ systemctl enable nginx
 STOPSIGNAL SIGRTMIN+3 STOPSIGNAL SIGRTMIN+3
 CMD ["/​sbin/​init"​] CMD ["/​sbin/​init"​]
-EOF+EOR
  
 docker build -t ubi9-nginx-systemd:​0.0.1 . docker build -t ubi9-nginx-systemd:​0.0.1 .
-docker run --name ubi9-nginx -d -p 8090:80 ubi9-nginx-systemd:​0.0.1+docker run --name ubi9-nginx ​--privileged ​-d -p 8090:80 ubi9-nginx-systemd:​0.0.1 
 +docker exec -it ubi9-nginx nginx -v
 docker exec -it ubi9-nginx systemctl status docker exec -it ubi9-nginx systemctl status
 docker exec -it ubi9-nginx journalctl -u nginx docker exec -it ubi9-nginx journalctl -u nginx
Zeile 131: Zeile 141:
 <code bash> <code bash>
 # build with compose # build with compose
-cat >​compose.yml <<EOF+cat >​compose.yml <<EOR
 services: services:
   nginx:   nginx:
     build: .     build: .
 +    privileged: true
     ports:     ports:
       - "​8090:​80" ​   ​       - "​8090:​80" ​   ​
Zeile 142: Zeile 153:
       - /tmp       - /tmp
     stop_signal:​ SIGRTMIN+3     stop_signal:​ SIGRTMIN+3
-EOF+EOR
 docker compose build docker compose build
 docker compose up -d docker compose up -d
Zeile 153: Zeile 164:
 <code bash> <code bash>
  
-cat >​Dockerfile <<EOF+cat >​Dockerfile <<EOR
 FROM registry.access.redhat.com/​ubi9/​ubi-init FROM registry.access.redhat.com/​ubi9/​ubi-init
-RUN dnf -y module enable ​nginx:1.24 +RUN cat <<'​EOF'​ >/​etc/​yum.repos.d/​nginx.repo 
- && ​dnf -y install nginx \+[nginx-stable] 
 +name=nginx stable repo 
 +baseurl=http://nginx.org/​packages/​rhel/​9/​\$basearch/​ 
 +gpgcheck=1 
 +enabled=1 
 +gpgkey=https://​nginx.org/​keys/​nginx_signing.key 
 +module_hotfixes=true 
 +EOF 
 + 
 +RUN dnf -y install nginx \
  &&​ dnf clean all  &&​ dnf clean all
  
Zeile 188: Zeile 208:
 STOPSIGNAL SIGRTMIN+3 STOPSIGNAL SIGRTMIN+3
 CMD ["/​sbin/​init"​] CMD ["/​sbin/​init"​]
-EOF+EOR 
 + 
 +# docker  
 +docker compose build 
 +docker compose up -d 
 +curl 127.0.0.1:​8090 
 +docker compose exec nginx systemctl status nginx-log-forwarder 
 +docker compose exec nginx journalctl -u nginx-log-forwarder 
 +# see access logs 
 +docker logs nginx_nginx_1 
 + 
 +# podman
 podman compose build podman compose build
 podman compose up -d podman compose up -d
admin_grundlagen/docker/build.1780162472.txt.gz · Zuletzt geändert: 2026/05/30 17:34 von peter_rossbach2