I initialize my container with 2 extra options that are not in the official instructions. Adding --name as portainer and configuring the --restart policy as unless-stopped.

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

Updating to a new version is just 3 lines.

sudo docker stop portainer
sudo docker pull portainer/portainer
sudo docker start portainer

docker run reference
portainer installation