Working with Hassio installed in Docker containers (through armbian-config)?

Hi all, my first post here.

I installed Hassio using armbian-config > Software > Softy > Hassio which installed Hassio in Docker containers. After exploring the options I decided to start from scratch (because I clicked on Gateway and I couldn’t remove that “sensor”) and I somewhere read that could be done by deleting all files in config folder. Then I typed:

sudo docker ps -a

to list the containers and there were the following containers running:

hassio_multicast
hassio_cli
hassio_audio
hassio_dns
homeassistant
hassio_observer
hassio_supervisor

Then I typed:

sudo docker exec -it homeassistant /bin/bash

and bash opened in the config folder:

bash-5.0# pwd
/config

Then I moved one directory back to / and tried to rename config directory to config_backup but there was an error:

bash-5.0# mv config config_backup
mv: can't rename 'config': Resource busy

I then went back to the config directory and deleted all the files using rm and that worked, after restarting the device (Orange Pi PC) everything was as when Hassio was just installed.

I couldn’t copy the config directory either:

bash-5.0# cp config config_backup
cp: omitting directory 'config'

Question(s):
Why it is not possible to rename or copy a directory inside Docker container but it is possible to delete the files, how directory structure inside Docker container could be changed and how some directory could be copied from the Docker containter to the outside file system?

I know that has to do something with how Docker works but I am not aware of the details.

What I would like to do is to add some new sensors to ESPHome (for example DS1621 temperature sensor) and I am sure for that to work I’ll have to make some modifications in the file system inside Docker containters. I did find a tutorial describing how to add a new sensor to ESPHome but I’d like to know how to do the same when Hassio runs in Docker containers.

with docker you mount volume you don’t need to use docker exec.
and you use container’s folder has your host’s folders :

docker run --init -d \
 --name homeassistant \
 --privileged \
 --restart=unless-stopped \
 -v /etc/localtime:/etc/localtime:ro \  
 -v /PATH_TO_YOUR_CONFIG:/config \
 --network=host \
 ghcr.io/home-assistant/home-assistant:stable

where -v = volume
ex: -v /home/hassioconfiginhome:/config
or in compose:

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /PATH_TO_YOUR_CONFIG:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host

ex: - /home/hassioconfiginhome:/config

but i see u used the script where you have to add -d if you need custom directory, as you see the default location should be ‘$PREFIX/share/hassio’

Run as root (sudo su):

curl -Lo installer.sh https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh
bash installer.sh

Command line arguments
argument 	default 	description
-m | --machine 		On a special platform they need set a machine type use
-d | --data-share 	$PREFIX/share/hassio 	data folder for hass.io installation
-p | --prefix 	/usr 	Binary prefix for hass.io installation
-s | --sysconfdir 	/etc 	Configuration directory for hass.io installation

I did not use exec trying to run the Docker container - as I described I used exec to open the bash inside the container to be able to use linux rm command to delete the Hassio configuration files.

When Hassio is installed through armbian-config everything works right after the instalation and Docker containers are automatically started after every reboot.

This was my question:

Question(s):
Why it is not possible to rename or copy a directory inside Docker container but it is possible to delete the files, how directory structure inside Docker container could be changed and how some directory could be copied from the Docker containter to the outside file system?

i m not speaking you about how starting container but about how docker’s volumes work and how to use them.
if you made a modification in the container and not in a mounted volume you will lose all your job next update.
in config directory hassio use a database file.constantly rewrited.i suppose it’s why you can remove this folder or copy this folder.

This method is considered advanced and should only be used if one is an expert in managing a Linux operating system, Docker and networking.

But why then I can remove the files inside the folder? I can remove the database file and all other files inside the config folder.

Seems as I’ll first have to research how Docker works.

BTW, I am assuming you wanted to write: “i suppose it’s why you can’t remove this folder or copy this folder.”.

As I said in the initial post - I already have running these components installed by armbian-config tool:

hassio_multicast
hassio_cli
hassio_audio
hassio_dns
homeassistant
hassio_observer
hassio_supervisor

line 758:

install_hassio ()
{

Install Home assistant smart home suite hass.io / Docker instance by using official installer

local arch=$(dpkg --print-architecture)

case $arch in
armhf)
local machine=raspberrypi2
;;
arm64)
local machine=raspberrypi4-64
;;
amd64)
local machine=intel-nuc
;;
*)
exit 1
;;
esac

if [ $? == 0 ]; then
install_docker
debconf-apt-progress – apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates
dbus jq network-manager socat software-properties-common
curl -sL “https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh” |
bash -s – -m ${machine}
dialog --backtitle “$BACKTITLE” --title “Please wait”
–msgbox "\nIt can take several minutes before Home Assistant UI becomes available! " 7 75

fi
}

your tool use the supervised-installer
i told you the way, i can’t tell you more than you won’t to eard maybe someone else will help you or have a better way to do things you want

Thank you very much for your help!! I’ll research what you have posted and how exactly docker works - then I will post back.

Regards

I don’t believe armbian-config is a supported installation method, so it may simply be wrong.

It is true that isn’t officially supported installation method but everything is working well - the only “problem” is I still have to research how docker containers work.