docker-lxc.sh aktualisiert

This commit is contained in:
2026-05-24 09:22:47 +02:00
parent abd939d760
commit b1e18c0a43
+25 -30
View File
@@ -338,28 +338,21 @@ docker run -d \
success "Portainer CE gestartet."
fi
# ── Proxmox Hinweise-Panel setzen ─────────────────────────────────────────────
# ── Proxmox Hinweise-Panel setzen (Markdown) ──────────────────────────────────
info "Setze Proxmox-Hinweise (Notes) für Container $CTID"
# IP ermitteln (kurz nach Start warten)
# IP ermitteln
sleep 2
NOTES_IP=$(pct exec "$CTID" -- hostname -I 2>/dev/null | awk '{print $1}' || echo "")
[[ -z "$NOTES_IP" ]] && NOTES_IP="(IP via DHCP siehe Konsole)"
# Debian-Logo SVG (inline Base64 als data-URI vermeiden → direkte SVG-Strings)
DEBIAN_SVG='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="52" height="52"><circle cx="50" cy="50" r="48" fill="#d70751"/><path d="M61.7 32.2c-1-.1-2 0-2.9.2 3.6 1.5 5.6 5.4 5.1 9.3-.4 3.3-2.6 6-5.4 7.4-1.6.8-3.4 1.1-5.2.9-3.6-.4-6.8-3-7.9-6.5-.4-1.3-.5-2.7-.2-4 .5-2.4 2.1-4.5 4.3-5.6 1.8-.9 3.9-1 5.8-.3-2.3-1.8-5.4-2.4-8.2-1.5-3.5 1.1-6 4.4-6.2 8.1-.1 1.9.4 3.8 1.4 5.4 2.2 3.6 6.5 5.5 10.7 5 2-.2 3.9-1 5.5-2.2 3.2-2.4 4.9-6.3 4.5-10.2-.1-2.2-.9-4.4-1.3-6z" fill="#fff"/><path d="M53.3 37.7c-1.6-.2-3.3.5-4.3 1.8-1.1 1.4-1.3 3.4-.5 5 .8 1.5 2.4 2.5 4.1 2.6 1.6.1 3.2-.6 4.2-1.9 1-1.3 1.3-3.1.7-4.7-.6-1.6-2.3-2.7-4.2-2.8z" fill="#fff"/></svg>'
DOCKER_SVG='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="52" height="52"><rect width="100" height="100" rx="14" fill="#2496ed"/><g fill="#fff"><rect x="13" y="46" width="12" height="11" rx="1"/><rect x="27" y="46" width="12" height="11" rx="1"/><rect x="41" y="46" width="12" height="11" rx="1"/><rect x="55" y="46" width="12" height="11" rx="1"/><rect x="27" y="33" width="12" height="11" rx="1"/><rect x="41" y="33" width="12" height="11" rx="1"/><rect x="41" y="20" width="12" height="11" rx="1"/><path d="M78 49c-1-4-5-6-9-5-1-4-5-7-9-7v1c3 0 6 2 7 5l1 2 2-1c3-1 6 1 7 4l0 1-1 0c-4 1-25 0-28 0l0 1c1 7 7 12 14 12 8 0 15-5 17-13l0-1z"/></g></svg>'
[[ -z "$NOTES_IP" ]] && NOTES_IP="n/a (DHCP bitte in Konsole prüfen)"
# Portainer-URL
if $INSTALL_PORTAINER; then
PORTAINER_URL="https://${NOTES_IP}:${PORTAINER_PORT}"
else
PORTAINER_URL=""
fi
# SSH-Zeile
SSH_LINE=""
# SSH-Befehl
if $ENABLE_ROOT_SSH; then
if [[ "$SSH_PORT" == "22" ]]; then
SSH_LINE="ssh root@${NOTES_IP}"
@@ -368,32 +361,34 @@ if $ENABLE_ROOT_SSH; then
fi
fi
# HTML für den Proxmox Notes-Bereich zusammenbauen
NOTE_CONTENT="<div style=\"font-family:sans-serif;line-height:1.6;padding:4px\">"
NOTE_CONTENT+="<div style=\"display:flex;align-items:center;gap:14px;margin-bottom:10px\">"
NOTE_CONTENT+="<a href=\"https://www.debian.org\" target=\"_blank\" title=\"Debian\">${DEBIAN_SVG}</a>"
NOTE_CONTENT+="<a href=\"https://www.docker.com\" target=\"_blank\" title=\"Docker\">${DOCKER_SVG}</a>"
NOTE_CONTENT+="</div>"
NOTE_CONTENT+="<div><strong>&#127760; IP-Adresse:</strong> ${NOTES_IP}</div>"
# Proxmox rendert --description als Markdown (kein HTML, kein SVG).
# Bilder via externer URL: shields.io badges als Logos funktioniert zuverlässig.
# Format: [![Alt](img-url)](link-url)
NOTE="[![Debian](https://img.shields.io/badge/Debian-A81D33?style=for-the-badge&logo=debian&logoColor=white)](https://www.debian.org)"
NOTE+=" "
NOTE+="[![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com)"
NOTE+=$'\n\n'
NOTE+="---"$'\n\n'
NOTE+="**🌐 IP-Adresse:** \`${NOTES_IP}\`"$'\n\n'
if $INSTALL_PORTAINER; then
NOTE_CONTENT+="<div><strong>&#128051; Portainer:</strong> <a href=\"${PORTAINER_URL}\" target=\"_blank\">${PORTAINER_URL}</a></div>"
NOTE+="**🐳 Portainer:** [${PORTAINER_URL}](${PORTAINER_URL})"$'\n\n'
fi
if $ENABLE_ROOT_SSH; then
NOTE_CONTENT+="<div><strong>&#128273; SSH:</strong> <code>${SSH_LINE}</code></div>"
NOTE+="**🔑 SSH:** \`${SSH_LINE}\`"$'\n\n'
fi
NOTE_CONTENT+="<div style=\"margin-top:10px;padding-top:8px;border-top:1px solid #ddd;font-size:0.85em;color:#555\">"
NOTE_CONTENT+="Installiert mit <a href=\"https://gitea.vourx.com\" target=\"_blank\">gitea.vourx.com</a>"
NOTE_CONTENT+=" &nbsp;|&nbsp; <a href=\"https://www.debian.org/releases/\" target=\"_blank\">Debian Docs</a>"
NOTE_CONTENT+=" &nbsp;|&nbsp; <a href=\"https://docs.docker.com\" target=\"_blank\">Docker Docs</a>"
NOTE_CONTENT+="</div></div>"
NOTE+="---"$'\n\n'
NOTE+="Installiert mit [gitea.vourx.com](https://gitea.vourx.com)"
NOTE+=" | [Debian Docs](https://www.debian.org/releases/)"
NOTE+=" | [Docker Docs](https://docs.docker.com)"
# In Proxmox als Container-Description (Hinweise) setzen
pvesh set /nodes/$(hostname)/lxc/${CTID}/config --description "${NOTE_CONTENT}" 2>/dev/null \
&& success "Proxmox-Hinweise gesetzt (sichtbar unter Container → Hinweise)." \
|| warn "Hinweise konnten nicht automatisch gesetzt werden."
# Setzen via pvesh
pvesh set /nodes/$(hostname)/lxc/${CTID}/config --description "${NOTE}" 2>/dev/null \
&& success "Proxmox-Hinweise gesetzt." \
|| warn "Hinweise konnten nicht gesetzt werden bitte manuell eintragen."
# ── SSH vollständig konfigurieren ─────────────────────────────────────────────
if $ENABLE_ROOT_SSH; then