Skip to content

Change ownership for /config folder #17

@jules-ch

Description

@jules-ch

Hey thanks a bunch for this useful entrypoint script.

I'm trying to bundle my configuration to a simple docker image for an easy deployment.

FROM homeassistant/home-assistant:0.117.6

COPY config /config
COPY docker/run /etc/services.d/home-assistant/run

But when running, I encounter permission issues since the config folder is owned by root on copy.

$ docker build . -t myhomeassistant
Sending build context to Docker daemon  81.92kB
Step 1/3 : FROM homeassistant/home-assistant:0.117.6
 ---> 26669f4698c0
Step 2/3 : COPY config /config
 ---> 902768762fc1
Step 3/3 : COPY docker/run /etc/services.d/home-assistant/run
 ---> 370e3f2ab030
Successfully built 370e3f2ab030
Successfully tagged myhomeassistant:latest

$ docker run -p 8123:8123 myhomeassistant
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing... 
starting version 3.2.9
[21:31:05] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:31:05] INFO: Creating user homeassistant with 1000:1000
[21:31:05] INFO: Initializing venv in /var/tmp/homeassistant-venv
[21:31:07] INFO: Activating venv
[21:31:07] INFO: Starting homeassistant
Fatal Error: Unable to create library directory /config/deps
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

It should be great to fix permission anyway in the script before dropping privileges.
Adding :

chown -R $USER:$GROUP /config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions