# Upgrading the Portainer Agent

The Portainer Agent is simple to upgrade, this process can be done either [through the Portainer UI](#upgrade-the-agent-through-the-portainer-ui) or [through the CLI](#upgrade-the-agent-through-the-cli).

## Through the Portainer UI

The simplest way to upgrade the Portainer Agent is through the Portainer UI.\
\
**Step 1:** Navigate to the Services view through the menubar of Portainer and select the checkbox of thhe Agent service you wish to upgrade, and click the update button.

![](https://1754797668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_5Fi8quGjgcLSMuygk%2F-LaDMMxOId2KGU64EGRj%2F-LaDMUYUaGUt60r-o3Ip%2FScreen%20Shot%202019-03-18%20at%201.46.57%20pm.png?alt=media\&token=1be68fa4-3add-49b5-b2a9-4351a527920a)

**Step 2:** A message will appear asking if you want to force an update. Make sure that 'Pull latest image version' is selected as shown below before clicking the update button.

![](https://1754797668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_5Fi8quGjgcLSMuygk%2F-LaDMMxOId2KGU64EGRj%2F-LaDMXJNF5ZXMg6DggqQ%2FScreen%20Shot%202019-03-18%20at%201.47.08%20pm.png?alt=media\&token=41afc2cf-49fd-4325-ace7-61a712e003ce)

**A confirmation message like the one below should appear in the top right corner of the Portainer UI if the Agent has been successfully updated.**

![](https://1754797668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_5Fi8quGjgcLSMuygk%2F-LaDMMxOId2KGU64EGRj%2F-LaDMZoI0_5-5z86vnFI%2FScreen%20Shot%202019-03-18%20at%202.08.57%20pm.png?alt=media\&token=de49bcde-c8e7-44e1-836b-8c45d71b5c5f)

## Through the CLI

{% hint style="warning" %}
**Note:** You need to make sure you are accessing the swarm manager node via the CLI to issue the below command
{% endhint %}

Enter the below command into the CLI (assuming your Docker service is called _portainer_). You can replace _portainer_ with the name of your service if yours is named something different.

```
docker service update --image portainer/portainer:latest portainer
```

**You are done!**
