# © Bobban 2021 - https://bobbantech.com # # This script will update the image version of the portainer-ce instance. # Update documentation is followed from https://documentation.portainer.io/v2.0/upgrade/upddocker/ # #Variable for what group the script is checking. group="docker"; #Checking if the running user is member of the docker group if id -nG "$USER" | grep -qw "$group"; then #This part will run if the user is member of the group. #Stopping the container echo "Stopping Portainer container"; docker stop portainer #Removing cointainer echo "Removing existing container with the old image"; docker rm portainer #Downloading latest image echo "Download the new image from repository"; docker pull portainer/portainer-ee:latest #Deploy echo "Deploying a new countainer with the new image"; docker run -d -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ee:latest else #This part will run if the user is not member of the group. echo " The user $user you are using is not member of the group $GROUP with is required to run this script. Please run this command to solve this issue 'sudo usermod -aG docker $USER'. a restart of your session may be needed. "; fi