How to install, uninstall and reinstall update Home Assistant Docker in Debian - Bind mounts

 

OS:Debian GNU/Linux 12 (bookworm)

@raspberrypi:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

 

 

Install

docker pull ghcr.io/home-assistant/home-assistant:stable

Deploy the container 

Via Docker Run
Via Docker Compose
Via Portainer

 

 

Before you run home assistant in docker you need to first decide where you will store persistent data.

Docker has two options:

Volumes
Bind mounts

source:https://stevessmarthomeguide.com/running-home-assistant-in-a-docker-container/

 

Update Home Assistant Docker options:

We now have 4 methods of Update our Home Assistant Docker  install

Direct upgrade via pip3
update Home Assistant Docker Via Docker Run
update Home Assistant Docker Via Docker Compose
update Home Assistant Docker Via Portainer

 

http://localhost:4999/boards/topic/20883/how-to-install-uninstall-and-reinstall-update-home-assistant-docker-in-debian#28434

 

2.1 Direct upgrade via pip3

docker ps
sudo docker exec -it caf156967843 bash
pip install --upgrade pip 
pip install --upgrade homeassistant
# 如果速度慢可以在命令后面加上[-i 加速镜像地址]
# pip install --upgrade homeassistant -i https://pypi.tuna.tsinghua.edu.cn/simple

2.2 update Home Assistant Docker Via Docker Run

docker pull ghcr.io/home-assistant/home-assistant:stable
docker stop homeassistant
docker rm homeassistant

sudo docker run -d 
  --name=homeassistant 
  --restart=always 
  --network=host 
  -v /etc/homeassistant:/config 
  homeassistant/home-assistant:stable

 

2.2.1 How to update Home Assistant Docker in Debian - Bind mounts detail:https://blog.matterxiaomi.com/blog/how-to-install-uninstall-and-reinstall-update-home-assistant-docker-in-debian-part1/

2.2.2 How to update Home Assistant Docker in Debian - Bind Volume

2.3  update Home Assistant Docker Via Docker Compose

However, this could be a little easier using a compose.yaml file (which holds all the details of the last command) and would look like:

services:
  homeassistant:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    volumes:
      - etc/homeassistant:/config
    network_mode: host
    privileged: true
    restart: always

then, your commands would be reduced to:

docker compose pull

and

docker compose up -d

 

2.4 Update Home Assistant Docker Via Portainer

I really recommend looking into and installing Portainer. It is installed in a docker container as well and simplifies a lot of things you normally do with docker.

For example, to update home assistant all I do is open the container in Portainer and click on ‘recreate’. there is a check box there asking if you want to pull the latest image. then click recreate.

it will download the latest image, stop the container and restart the container using that image.

 

You can delete any images that are tagged unused.

 

Useful links

https://jackstromberg.com/2020/03/how-to-update-home-assistant-docker-container

https://www.homeassistantcoach.com/how-to/home-assistant-setup/how-to-set-up-home-assistant-in-docker/

 

https://stevessmarthomeguide.com/running-home-assistant-in-a-docker-container/

 

Via Docker Run

Via Docker Compose

Via Portainer

https://cloud.tencent.com/developer/article/2086860

 

Comments


Comments are closed