For any new Helmut4 installation, the latest versions of Docker and Portainer CE (community version) will always be downloaded and installed.
For more information, please refer to the Helmut4 Server documentation.
Updates
Subsequent updates or upgrades of Docker and Portainer are the responsibility of the customer or hosting support. Helmut4 updates do not manage the current versions of Docker and Portainer.
When performing updates, please review the specific release notes for Docker and Portainer to ensure compatibility. It's important to test updates first in a staging environment before applying them to the production environment.
LTS (Long-Term Support) versions can be identified by the tag :lts
STS (Short-Term Support) versions can be identified by the tag :sts
Remove and re-deploy latest Portainer CE
Please use the provided script with caution, as Portainer is not within Helmut4's scope / support.
#!/bin/bash# Update Portainer to the latest community edition# moovIT GmbH - B. Dimmel# Version 3.0# Changelog: Jan 31st 2025# Update Portainer from v1.x to 2.x# Can also be used to update 2.x to a newer version# Get container ID by 'names', making it more dynamically# Add option to pick LTS or new STS Short-Term version# changed tag latest to lts# fixed syntax error in docker pull command# added check if script is run with sudo permissions# added check if the existing container is CE or EE# Improved error handling# Refactored deployment process# Refactored the stopping and purging of deprecated Portainer images + containers# Check if the script is run with sudo permissionsif [ "$EUID"-ne0 ]; thenecho"Please run this script as root (e.g., 'sudo ./script.sh')"exit1fiportainerTargetCode="ce"portainerTargetName="Community Edition"portainerWrongCode="ee"portainerWrongName="Business Edition"# Find the running container ID for Portainercontainer_id=$(dockerps--filter"name=portainer"--format"{{.ID}}")# If no running Portainer container is found, notify and continueif [[ -z"$container_id" ]]; thenecho"No running Portainer container found. Skipping version check."else# Get the image name of the existing container existing_image=$(dockerinspect--format='{{.Config.Image}}'"$container_id")echo-e"\nFound running Portainer container using image: $existing_image"# Check if it's an EE versionif [[ "$existing_image"==*"portainer-$portainerWrongCode"* ]]; thenecho-e"\n!!!!!!!!!!!!\nYou are trying to replace portainer $portainerWrongCode ($portainerWrongName) with $portainerTargetCode ($portainerTargetName)\n\nExiting.\n\n"exit1fifi# Prompt user for LTS, STS, or quit optionwhiletrue; doecho-e"\nDo you want to update to the latest LTS (Long-Term) or STS (Short-Term Support) version?\n"read-p"Enter 'lts', 'sts', or 'quit': "version_choicecase"$version_choice"inlts) docker_tag="portainer/portainer-$portainerTargetCode:lts"break ;;sts) docker_tag="portainer/portainer-$portainerTargetCode:sts"break ;;quit)echo-e"Portainer update aborted!\n"exit0 ;;*)echo-e"Invalid choice!\nPlease enter 'lts', 'sts', or 'quit'.\n" ;;esacdone# Confirm before proceedingwhiletrue; doecho-e"\n==> You have chosen: $version_choice <==\n"read-p"Proceed with this version? (y/n): "confirm_choicecase"$confirm_choice"in[yY])break ;;[nN])echo-e"Please choose again.\n"continue ;;*)echo"Invalid input. Please enter 'y' or 'n'." ;;esacdone# Stop and remove all existing Portainer containersportainer_containers=$(dockerps-a--filter"name=portainer"--format"{{.ID}}")if [[ -n"$portainer_containers" ]]; thenecho-e"\nFound the following Portainer containers: $portainer_containers"# Stop all running Portainer containersecho-e"\nStopping all running Portainer containers ...\n"for container_id in $portainer_containers; doifdockerps--filter"id=$container_id"--format"{{.ID}}"|grep-q.; thenifdockerstop"$container_id">/dev/null2>&1; thenecho"Stopped Portainer container: $container_id"elseecho"Failed to stop Portainer container: $container_id. Continuing ..."fifidone# Remove all Portainer containersecho-e"\nRemoving all Portainer containers ..."for container_id in $portainer_containers; doifdockerps-a--filter"id=$container_id"--format"{{.ID}}"|grep-q.; thenifdockerrm"$container_id">/dev/null2>&1; thenecho-e"\nRemoved Portainer container: $container_id"elseecho-e"\nFailed to remove Portainer container: $container_id. Exiting."exit1fifidoneelseecho-e"\nNo existing Portainer containers found. Proceeding with deployment."fi# Ensure no stopped Portainer containers remain before deploymentifdockerps-a--filter"name=portainer"--format"{{.ID}}"|grep-q.; thenecho-e"\nForce removing any remaining Portainer containers ..."dockerrm-f $(dockerps-a--filter"name=portainer"--format"{{.ID}}")fi# Find and remove all Portainer imagesecho-e"\nSearching for all Portainer images to remove ..."portainer_images=$(dockerimages--format"{{.Repository}}:{{.Tag}}"|grep-E"portainer/portainer(-$portainerTargetCode)?"||true)if [[ -n"$portainer_images" ]]; thenecho-e"\nRemoving the following Portainer images: $portainer_images"while IFS=read-rimage; doif [[ -n"$image" ]]; thenecho-e"\nRemoving image: $image"ifdockerrmi-f"$image">/dev/null2>&1; thenecho-e"\nRemoved Portainer image: $image"elseecho-e"\nFailed to remove Portainer image: $image. Continuing ..."fifidone<<<"$portainer_images"elseecho-e"\nNo Portainer images found to remove."fi# Pull the latest Portainer Community Edition imageecho-e"\nPulling the specified Portainer-$portainerTargetCode image: $docker_tag ..."ifdockerpull--quiet"$docker_tag">/dev/null2>&1; thenecho-e"\nLatest Portainer-$portainerTargetCode image pulled successfully."elseecho-e"\nFailed to pull the latest Portainer-$portainerTargetCode image. Exiting."exit1fi# Deploy the new Portainer containerecho-e"\nDeploying the new Portainer-$portainerTargetCode container ..."ifdockerrun-it-d--restart=always-p9000:9000--name=portainer-v/var/run/docker.sock:/var/run/docker.sock-vportainer_data:/data"$docker_tag">/dev/null2>&1; thenecho-e"\n\n => Portainer $portainerTargetName has been successfully deployed. <=\n\n"elseecho-e"\nFailed to deploy Portainer $portainerTargetName. Exiting.\n"exit1fi
Docker Update
To update the Docker environment or engine, please refer to the documentation provided by your host operating system manufacturer, such as Ubuntu.
The update commands can vary depending on the distribution running on your server.