Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
erstes Docker Image selbst bauen
Pakete
Rocky Linux (10):
dnf config-manager --enable crb dnf install -y epel-release dnf install -y debootstrap
Debian (ab 12)
apt install -y debootstrap
Image bauen
sudo debootstrap --variant=minbase trixie ./debian http://debian/debian sudo tar cC debian/ . | docker image import - ingo/debian:trixie
Tag latest hinzufügen:
docker image ls ingo/debian:trixie
→ id rauskopieren (z.B. dc9f1edde160)
docker image tag dc9f1edde160 ingo/debian:latest
testen
docker container run ingo/debian echo hello world
→ hello world
Dockerfile - Docker Images weiterbauen
mkdir nginx cd nginx
- Dockerfile
FROM ingo/debian:trixie ENV DEBIAN_FRONTEND=noninteractive RUN set -eux; \ apt-get -qq update; \ apt-get install -y --no-install-recommends nginx RUN echo 'A warm welcome from your Dockerfile' > /var/www/html/index.html EXPOSE 80 ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"] ARG REFRESHED_AT=2026-01-07 LABEL version="0.0.1" LABEL maintainer="me@example.com" LABEL org.opencontainers.image.authors="me@example.com" LABEL org.opencontainers.image.created=$REFRESHED_AT
2)
++++ podman |
bei Podman darf die Datei auch Containerfile heißen
++++
++++ ENTRYPOINT / CMD / run-Command |
ENTRYPOINT | CMD | run-Command | ausgeführt wird |
|---|---|---|---|
["script.sh"] | script.sh |
||
["script.sh"] | /bin/dash | script.sh /bin/dash |
|
["script.sh"] | ["httpd"] | script.sh httpd |
|
["script.sh"] | ["httpd"] | /bin/dash | script.sh /bin/dash |
["/bin/sh"] | /bin/sh |
||
["/bin/sh"] | /bin/dash | /bin/dash |
|
/bin/bash |
++++
Image mit den Erweiterungen aus dem Dockerfile bauen:
docker build -t='ingo/nginx:0.0.1' .
Image anzeigen:
docker image ls ingo/nginx:0.0.1
→ id rauskopieren (z.B. 5879d7773761)
Image taggen:
docker image tag 5879d7773761 ingo/nginx:latest
Container starten:
docker container run -d -p 80:80 --name my_nginx ingo/nginx
Zugriff auf nginx testen:
curl -s http://localhost:80
→ im Browser http://localhost öffnen
Docker Image aktualisieren
- Dockerfile
… RUN ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log …
docker build --no-cache --pull -t='ingo/nginx:0.0.2' .
++++ podman |
podman build --no-cache -t='ingo/nginx:0.0.2' .
→ allerdings werden dann alle 12 STEPs neu gebaut.
TODO: liegt das an dem fehlenden –pull? AI Slop Vermutung: Docker built your image without errors because it keeps un-namespaced local images as-is. In contrast, Podman automatically prefixes locally built or untagged registry images with localhost/ to prevent collisions with official registries. When you use the –pull flag, Podman is forced to try downloading a fresh version of that base image from an external source. Because it sees localhost/ingo/debian:trixie, Podman literally looks for a web-facing registry running on your actual machine (https://localhost/v2/). Since you don't have a container registry service actively running on port 443 of your host machine, the network request fails with „connection refused“
++++
Jetzt noch mal testen und
docker logs
ansehen.
Bauen mit einem Release Zeitstempel:
REFRESHED_AT=$(date '+%Y-%m-%d') docker build --no-cache --pull \ --build-arg REFRESHED_AT=$REFRESHED_AT \ -t='ingo/nginx:0.0.2' \ -t=ingo/nginx:$REFRESHED_AT .
error, not allowed. Docker Version 20.10.24+dfsg1 hat bash ausgeführt.