Upgrade HomeAssistant on Docker in Ubuntu

I thought one of the advantages of docker was that I could save my config file directory, rename existing home assistant container, then run

sudo docker run -itd --name=home-assistant -v /home/mythuser/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --privileged --device /dev/ttyACM0 --restart=always --net=host homeassistant/home-assistant

But I still see the old version from the web interface.

What is the correct way to do this? I want a way I can backtrack quickly if the upgrade goes south.

I created a script for it which works fine.

sudo docker stop ha-heurik
sudo docker rm ha-heurik
sudo docker pull homeassistant/home-assistant
sudo docker run -p 8123:8123 -d --name="ha-heurik" -v /home/hvdheurik/haconfig:/config -v /etc/localtime:/etc/localtime:ro --net=bridge homeassistant/home-assistant

Which would be the following for your situation :

sudo docker stop home-assistant
sudo docker rm home-assistant
sudo docker pull homeassistant/home-assistant
sudo docker run -d --name=home-assistant -v /home/mythuser/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --privileged --device /dev/ttyACM0 --restart=always --net=host homeassistant/home-assistant

When you do all that are you also refreshing the lovelace view and clearing the cache?

sudo docker pull home-assistant
sudo docker stop home-assistant
sudo docker run -itd --name=home-assistant -v /home/mythuser/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --privileged --device /dev/ttyACM0 --restart=always --net=host homeassistant/home-assistant

Just a heads up, you do not need -it in there at all -d is sufficient.

I would suggest you set up docker-compose instead though.

Perfect, that did it. Thanks.