Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ownership for /config folder #17

Open
jules-ch opened this issue Nov 12, 2020 · 1 comment
Open

Change ownership for /config folder #17

jules-ch opened this issue Nov 12, 2020 · 1 comment

Comments

@jules-ch
Copy link

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
@jules-ch
Copy link
Author

jules-ch commented Nov 12, 2020

After adding this:

$ 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:36:40] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:36:40] INFO: Creating user homeassistant with 1000:1000
[21:36:40] INFO: Initializing venv in /var/tmp/homeassistant-venv
[21:36:42] INFO: Fix permission on /config
[21:36:42] INFO: Activating venv
[21:36:42] INFO: Starting homeassistant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant