Updating portainer to v2 on a swarm setup

We currently run portainer v1.24.1 in a swarm setup.
We want to upgrade to portainer v2.

Would changing the container image for the portainer service to portainer/portainer-ce do the trick.
Or should we better install fresh creating a new service for v2 from scratch.

Hi pl let us know the OS, docker swarm version , is there any NFS volume mounted with portainer

Hi Bala,

Server OS: Ubuntu 18.04.3
Swarm version:
Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:21:05 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:19:41 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
We have 1 NFS volume mounted within portainer.

Hi
pl take the backup of the services and upgrade the portainer service from 1.24.1 to 2.0
curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
docker stack deploy -c portainer-agent-stack.yml portainer

you can follow this read me.