Fix IP address detection in Portainer for cross-distribution compatibility

- Replace hostname -I with ip addr parsing for better compatibility
- hostname command may not be available or behave differently on some systems
This commit is contained in:
Mărcziem ™
2025-10-06 11:10:52 +02:00
parent c49e88a9b2
commit ced9c14add

View File

@@ -45,7 +45,9 @@ install_portainer() {
sleep 5 sleep 5
log_success "Portainer wurde erfolgreich installiert und läuft auf Port 9000 (HTTP) und 9443 (HTTPS)." log_success "Portainer wurde erfolgreich installiert und läuft auf Port 9000 (HTTP) und 9443 (HTTPS)."
log_info "Portainer ist nun verfügbar unter: https://$(hostname -I | awk '{print $1}'):9443" local ip_address
ip_address=$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | head -1 | awk '{print $2}' | cut -d/ -f1)
log_info "Portainer ist nun verfügbar unter: https://${ip_address}:9443"
} }
# Logging-Funktionen bereitstellen, falls nicht vorhanden # Logging-Funktionen bereitstellen, falls nicht vorhanden