Docker version does not upgrade

I am running Home Assistant in a docker with this command:
docker run -d --name="home-assistant" -v /home/sander/hass/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --device /dev/ttyACM0:/dev/ttyACM0 --net=host homeassistant/home-assistant

Now, I want to upgrade to current latest version (0.64.3 as we speak):
docker stop home-assistant
docker pull homeassistant/home-assistant:0.64.3
docker start home-assistant

After that, I’ve checked the running containers.

balk@ubakfiets:~/hass$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
xxxxxxxxxxx        xxxxxxxxxxxxx        "python -m homeassis…"   2 weeks ago         Up 15 minutes                           home-assistant

I even ran the update again:

0.64.3: Pulling from homeassistant/home-assistant
Digest: sha256:7c9aa876c813cf8e0b8025336bc6bb68f03dd7b22d331d605de8074485490f3a
Status: Image is up to date for homeassistant/home-assistant:0.64.3

But the version of Home Assistant starting is an older one:

2018-03-04 00:22:48 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.current_version, old_state=None, 
new_state=<state sensor.current_version=0.63.2; friendly_name=Current Version 

Does anyone know what is going on here? According to systemctl there is no other instance running.

That’s how docker works. You have created a container from a previous image and named it “home-assistant”. The container was stopped, then the home-assistant image was updated and then the stopped container was started again. The result is as expected.

You need to destroy and re-create the container to make it use the latest image.

docker pull homeassistant/home-assistant:0.64.3
docker rm -f home-assistant
docker run -d --rm --name="home-assistant" -v /home/sander/hass/homeassistant:/config \
   -v /etc/localtime:/etc/localtime:ro --device /dev/ttyACM0:/dev/ttyACM0 --net=host \
   homeassistant/home-assistant

As you can see, I added the --rm flag to the run command. This way the container will be removed automatically once it was stopped.

1 Like

Great! Thanks! It works. Still learning how to deal with Docker :slight_smile:

Small change in your command, -d should be after --rm

docker pull homeassistant/home-assistant:0.64.3
docker rm -f home-assistant
docker run --rm -d --name="home-assistant" -v /home/sander/hass/homeassistant:/config \
  -v /etc/localtime:/etc/localtime:ro --device /dev/ttyACM0:/dev/ttyACM0 --net=host \
  homeassistant/home-assistant
1 Like