There are 2 ways for upgrade ThingsBoard IoT Gateway, depends on a version that you want (Release or Develop).
sudo pip3 install thingsboard-gateway --upgrade
To upgrade ThingsBoard IoT Gateway docker installation use Upgrading step from Docker installation guide.
**Notate: ** If you have some issues with upgrade, please try to remove package from pip in every system layer (sudo, user, local).
To do this please run following command:
sudo pip3 uninstall thingsboard-gateway -y
After removal, you need to install the gateway again using command above.