How To Edit yaml files with Home Assistant in Docker Container and No Supervisor

Edited to trim down to one question: I need some help please. I have installed Docker, Portainer and setup HomeAssistant in a docker container on Raspi. I don’t know how to edit any of the yaml files. I get access denied when I try to edit the files from the CLI. Because of the way I installed it, supervisor is not availalble and I’ve read that I shouldn’t add it because it is unsupported this way and unstable.

What is the best option for editing yaml files?

Hard to say

  1. You ask 2 unrelated questions in one post. This is a recipe for confusion

  2. You refer to an icomfort integration, or maybe addon. Where do you see this documented, maybe someone can then help.

My apologizes for combining questions. How do I edit docker yaml files when my install doesn’t have supervisor. I’m assuming that if I had supervisor, I could add a file editor that could access yaml files. But I may be totally wrong.

With any text editor. All your editable files are in your os

-v /PATH_TO_YOUR_CONFIG:/config \

In PATH_TO_YOUR_CONFIG

Link the /config folder in your docker command to be outside the container. Your config folder should be available for everything you want to do, and be allowed to (aka sudo might be necessary). You can use every editor installed in the base system.

And yes, regarding the second question, it’s not a good idea to try to install Supervisor in such a way. If you want Supervisor, and with it Add-ons and such, you should really think about running HA-OS. It is much easier to work with, and you can focus on the things that matter, like using HA instead of constantly configuring it. :laughing:

If you run what you said on an RPi, are you really running something else on that machine? And what Pi are we talking about anyway? :slight_smile: If you just run Portainer and with it HA, it’s just wasted energy. :wink: The ressources Portainer takes, are way better invested in HA (and HA-OS) than in a docker managing program.

EDIT: the only thing I could find regarding icomfort are all integrations, not Add-ons. Integrations can be installed in HA core (your install). Let us know, or give a link to the integration/Add-on you’re reffering to. :slight_smile:

Paddy. Thanks I’ll try to figure how to link the folder outside the container.

I have Homebridge running on the Raspi 4, some I’m only running HA for Schlage WiFi to HomeKit integration. And maybe Lennox IComfort Dual Zone.

I may be confused about terms. The icomfort I’m talking about is GitHub - thevoltagesource/LennoxiComfort: Home Assistant custom component for controlling Lennox iComfort WiFi and AirEase Comfort Sync thermostats.. It is an interface for the dual zone thermostat on Wi-Fi. How would I install it?

It is in the instructions! Linux - Home Assistant

Thanks. I appreciate the help.

Thanks. Will read.

I’ve run into the same problem…

I’ve been using Home Assistant OS (formerly hass.io) for about 4 years now, but recently I’ve started running everything inside Docker containers because I’m tired of the complications of migrating software from one physical device to the other (when I upgrade the hardware) and from one OS to the other (when I upgrade the OS). With Docker, migration is super simple because everything is isolated from the host. So that’s why it is a very good idea to run software in containers (not just, but including Home Assistant).

However, after I’ve set up Home Assistant to run inside a container, I’ve sadly noticed that this setup is far from being as usable as Home Assistant OS. Running the HA container behind a reverse proxy does not work from start, it requires some tweaks in the HA configuration file. But… surprise… I can’t access the config file using the File Editor add-on because add-ons are not available (bummer). Yes, I know that I could map the config dir of the container into the host and edit the files directly, but I prefer not to map anything outside Docker volumes (keep things isolated). Also I think it’s a waste of hardware resources to run only HA OS on a Raspberry Pi, when you can run many pieces of software in containers on the same Raspberry Pi (RPI 4 or RPI 5), since the newer RPI models have more than enough CPU and RAM for this.

I wish there was an all-in-one solution for Home Assistant, similarly to what Nextcloud has, which just sets up all containers, including the supervisor.

How on earth could you configure anything if you don’t map anything outside docker.

The instructions require it.

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=MY_TIME_ZONE \
  -v /PATH_TO_YOUR_CONFIG:/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

That’s the point, that there should not be a forced need to map files/directories outside the container. Instead the HA configs should live inside the Docker volume and the HA UI should be the only tool necessary to edit the configs. Ideally we should not touch config files at all, HA UI should provide functionality to modify settings in a nice graphical manner. Things have been slowly moving towards that in the last years. Until we fully get there, the UI should provide a config file editor. That is the File Editor add-on when add-ons are available (there is no such functionality when HA runs in a container unfortunately). So I think editing config files should be core HA functionality, not an add-on.

Anyway, I found a VSCode extension (made by Microsoft, called Dev Containers) which is able to connect from a remote computer directly into the container, so I’m able to edit the config files inside the container from my Windows PC.

The point I was trying to make earlier is that it would be nice to support a full HA experience (that includes add-ons, automatic updates and backups) not just when using HA OS, but also when running containers. There should be a Docker Compose file to run a HA CORE container, a supervisor container, the basic default add-on containers, etc. If somebody does not want to run some of those containers, they can just comment them out from the Docker Compose file.

Either there is something you don’t know about docker, or I don’t.

What happens when you update your ha image? Surely you lose your config.

Well, I’m no Docker expert, but here is my understanding:

The recommended way to store data for Docker containers is in Docker volumes, which are isolated from the host. The alternative is to use bind mounts, which are basically host folders directly mapped into the containers. Volumes are persistent, unless you explicitly delete them, they persist between multiple runs of the container. So when you update the HA image, you just stop the container, pull the new image and then start the container back up, using the same volume that it was using before, which still contains the same data.

In my understanding it is desired to keep containers as isolated from the host as possible, meaning you should only use bind mounts if you absolutely have to.

More info here: Manage data in Docker | Docker Docs

Thank you. Interesting. Looks like me who didn’t understand.

1 Like

Hi Paddy, I have tried and tried to do this and I just can’t figure it out. I am not good at all with any of this code stuff so I basically have to cut and paste this all… I did read the “instructions” you posted but they made no sense. I don’t know how to do what they show. It’s like there is a missing step to get me to where they are doing what they are showing.

I am running on a docker using QNAP Container Station. I try to access the docker but it says the files do not have permission to be accessed since they are in the container station.

When I built the docker, I told it that I wanted my config on a shared drive on my nas and it did load several folders in there, cusom_compents folder is there, etc. There is a configuration. yamil file in there but it is not being used as it was last edited several weeks ago and I have made changes to the HA since then.

I created a new vs studio container as well to be able to edit but I can’t figure out where my config file actually is AND, once I do, how do I edit it.

Any help is appreciated.

You replied to me, but I am not Paddy. No problem.

When you built your docker, the shared drive that you pointed too should mirror what the container sees.

Just because your configuration.yaml hasn’t changed, doesn’t mean its the wrong one. Not all config is stored in that file, in fact only stuff you change manually from an editor is stored there.

As far as editing goes, any editor that you use on your qnap.

Look at the file home-assistant.log in the same directory, is it recently written to?

Hi,
just trying to add some clarification here:
when you use Docker volumes (depending on driver, etc) by default you still use the host’s storage. That said, using a bind mount, or a volume mount, makes no real difference in terms of where the data will live in the end:

  • Using a bind mount (e.g.: “$(pwd)/config:/config”) you will use a directory in the host which will be on your working directory (pwd) and then “config”.
  • Using a docker volume, the files will still be in the host, but in a Docker-managed path. Usually /var/lib/docker/volumes

That said, unless you use a network storage for your volume (samba/cifs, nfs, etc) your files will still be in the host.

Also, destroying a container, does never destroy the bind mount directory, nor the volume. But if you use docker-compose, you could destroy the volume too if you used down -v.

And when this doesn’t answer the original topic’s question (which is what I was after, and how I ended up here), I hope this clarifies a bit about docker volumes to those who end up here.

cc @nickrout