How to Deploy & Update Portainer

Share this post:

This quick guide / tutorial is all about deploying Portainer with the default one-liner CLI that is available from their website and how to update it afterwards so you are not running an outdated instance.

Installation / Deployment

First of all I will assume that you deployed your Portainer instance using their default one liner

Create Data Volume

docker volume create portainer_data

Deploy & Run Portainer

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

At this point your Portainer instance should be up and running and you can access it by pointing your web broswer at https://IPAddress:9000/

Updating Portainer

In order to update Portainer first we will have to stop the container from running and then remove it. By removing the container and not deleting the data volume portainer_data your configuration is safe and we will load it once we have the updated image of portainer.

Stopping & Removing Portainer container

By typing the following two commands you will stop the container and then remove it.

docker stop portainer
docker rm portainer

Removing outdated Portainer image

Once the container is stopped and removed then we will need to get the portainer image’s ID number and delete it.

docker image ls | grep portainer

In my case my ID number was 62771b0b9b09 so I will run the following command to delete the old image.

docker image rm 62771b0b9b09

Pulling latest Image

Now we will have to pull the latest image of Portainer by typing:

docker pull portainer/portainer-ce

Running a new updated Portainer container

When its finished downloading the latest image you can a new instance of Portainer using the your old data volume so your previous configuration will be linked to your new container instance.

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

And that’s it! No excuses now… you should be able to run and keep Portainer up to date.

Share this post: