Portainer is a popular open-source tool that allows users to manage Docker containers, images, and networks through a web interface. In order to take advantage of the latest features and bug fixes, it is important to keep Portainer up-to-date. Unlike other scripts that has an automatic code update functionality inbuilt, Portainer has to be manually updated by deleting the older version from the server and installing the latest version. You can remove portainer without any worry as removing portainer is safe unless no other docker image or configuration is changed. In this article, we will walk you through the steps to update Portainer to the latest version on an Ubuntu server.
Step 1: Check the Current Version of Portainer Before you begin updating Portainer
It is important to check which version you are currently running. To do this, open your web browser and navigate to your Portainer URL (for example, http://<your-server-ip>:9000). Then, click on the “Settings” icon in the left-hand menu, and select “About” from the dropdown menu. This will display the current version of Portainer that you are running.
Step 2: Stop the Portainer Container Before updating Portainer
It is important to stop the Portainer container to prevent any conflicts or issues during the update process. To do this, open a terminal window on your Ubuntu server and type the following command:
sudo docker stop portainer
This will stop the Portainer container.
Step 3: Remove the Existing Portainer Container
Once you have stopped Portainer, remove the portainer image before downloading the latest version to avoid an conflicts. To do this, type the following command in your terminal window:
sudo docker rm portainer
This command will remove the existing Portainer container from your Ubuntu server.
Step 4: Download the Latest Portainer Image
To update Portainer to the latest version, you will need to download the latest Portainer image from Docker Hub. To do this, type the following command in your terminal window:
sudo docker pull portainer/portainer-ce:latest
This command will download the latest Portainer image to your Ubuntu server.
Step 5: Start the New Portainer Container
Now that you have removed the existing Portainer container, you can start a new container using the latest Portainer image. To do this, type the following command in your terminal window:
sudo docker run -d --name portainer -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce
This command will start a new Portainer container using the latest Portainer image.
Step 6: Verify the Update
Once you have started the new Portainer container, you can verify that the update was successful by navigating to your Portainer URL (for example, http://<your-server-ip>:9000) and checking the “About” section in the “Settings” menu. The version number should now match the latest version available on Docker Hub.
Congratulations, you have successfully updated Portainer to the latest version on your Ubuntu server!