Home Assistant in Docker container ignores allowlist_external_dirs directive

I have following in my configuration.yaml:

leonbrag@hpdebian:/media/data/hass$ cat configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#notify: !include notify.yaml

homeassistant:
  name: Home
  allowlist_external_dirs:
    - /media-frigate/clips

Both name & allowlist_external_dir is ignored after many reloads, restarts, etc.

This is how I know:

  1. Name is not changes in HASS UI
  2. In my automation I have following:
   images: >-
          -/media-frigate/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg

And this generates error: Error: remote_path_not_allowed

However when I am inside of HASS Container, path does exist:


leonbrag@hpdebian:~$ sudo docker exec -it homeassistant bash
hpdebian:/config# cd /media-frigate/clips/
hpdebian:/media-frigate/clips# pwd
/media-frigate/clips
hpdebian:/media-frigate/clips#

What needs to happen for HASS in Container allow this path?

thanks

Did you also map that directory when you started the container?

yes.

The issue is not docker. It’s mapped correctly

This is output from inside of the docker container:

hpdebian:/mediaFrigate/clips# pwd
/mediaFrigate/clips
hpdebian:/mediaFrigate/clips# df -h
Filesystem                Size      Used Available Use% Mounted on
overlay                 226.7G      6.8G    208.4G   3% /
tmpfs                    64.0M         0     64.0M   0% /dev
shm                      64.0M         0     64.0M   0% /dev/shm
/dev/sda1               457.4G     21.9G    412.2G   5% /config
/dev/sdb1               457.4G    253.9G    180.2G  58% /mediaFrigate
/dev/nvme0n1p2          226.7G      6.8G    208.4G   3% /etc/localtime
/dev/nvme0n1p2          226.7G      6.8G    208.4G   3% /etc/resolv.conf
/dev/nvme0n1p2          226.7G      6.8G    208.4G   3% /etc/hostname
/dev/nvme0n1p2          226.7G      6.8G    208.4G   3% /etc/hosts

I renamed to remove dash just in case. /mediaFrigate is correctly mapped and fully accessible

Not answering your question… but allowlist_external_dirs also doesn’t work for me.

Here’s what’s working for me:

In docker compose.yml:

services:

  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /home/pi/hass:/config
     # for mapping local media
      - /home/pi/media:/media
...

No allowlist_external_dirs configured in HA configuration.yaml

Then for sending image to my android cell, the image link looks like this:

...
      data:
        ttl: 0
        priority: high
        image: /media/local/frigate/clips/backyardcam-latest.png

Note the extra “local” in path. Without it, it wouldn’t work. Don’t ask me why. :wink:

Some other automation action does not need the “local” in the path to access the image. Again, don’t ask me why.

I’m curious what “action” you have in your automation. I also notice “images” vs “image” in my code.

Lastly, frigate has a pretty useful notifications blueprint, in case that helps.

EDIT: note my frigate docker compose have mapped these volumes:

frigate:
...
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/pi/frigate/config:/config
      - /home/pi/media/frigate:/media/frigate
...

I will try. Blueprint is for push. I am not interested in it.

I also write to write my own for flexibility.

I am shocked simplest and p0 task of sending email with attachment (not URL) to image is so complex.

no. the same problem:

homeassistant | 2024-08-23 14:32:04.911 ERROR (MainThread) [homeassistant.components.automation.email] Error while executing automation automation.email: remote_path_not_allowed

this is from docker:

I think I will look for some commercial solution. It’s unfortunate. Core scenario of sending email w/attachment should not be that difficult.

sorry can’t help you there with email action. Does it work without the image attachments?

The missing space betwen “-” and “/” in your path could be the culprit.

It should look something like that in yaml:

        images:
          - /media/frigate/clips/backyardcam-latest.png

note the space in “- /media/…”

yes. But notification w/out image attachment is useless :slight_smile:

Ok, it’s working now!
The frigate image is not there for some reason (but this is not related).

But this is what I had to do:

in my automation:


        images:
          - >-
            /media/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpggger.payload_json['after']['id']}}.jpg

HASS actually changes my input on saving. I entered:


         images:
          -  /media/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg

In HASS configuration:

homeassistant:
  name: Home
#  allowlist_external_dirs:
#    - /mediaFrigate
#  allowlist_external_urls:
#    - http://hpdebian:5000/
  media_dirs:
    media: /media

In Compose:

 homeassistant:
    depends_on:
      mqtt5:
        condition: service_started
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /media/data/hass:/config
      - /etc/localtime:/etc/localtime:ro
      - /media/video:/media:ro #mount frigate media

The docker Frigate mounting is like this:


 - /media/video:/media/frigate