tobiasehlert / teslamateapi

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON
MIT License
89 stars 20 forks source link

Permission denied error while starting container with version 1.17.0 #273

Closed bscx closed 6 months ago

bscx commented 6 months ago

I just pulled the latest docker image and after rebuilding and starting it (docker compose up -d), this error would show:

Error response from daemon: OCI runtime create failed: container_linux.go:377: starting container process caused: chdir to cwd ("/root") set in config.json failed: permission denied: unknown

Can this be related to https://github.com/tobiasehlert/teslamateapi/pull/266?

Please let me know how I can support!

Thanks for your great work!

tobiasehlert commented 6 months ago

thanks for reporting @bscx, I'll check into this :)

tobiasehlert commented 6 months ago

@bscx, I do not encounter that problem as you describe.. could you please share your docker compose configuration?\ Makes troubleshooting a bit easier :)

Also, are you mounting some configuration into the container for the COMMANDS_ALLOWLIST environment variable?\ I don't do that in my setups I'm running, which is my thought right now.

Straight away I would say #266 should not be related, but lets figure it out :)

bscx commented 6 months ago

Thanks for looking into this so quickly.

Is the teslamateapisection of my docker-compose.yml sufficient?

  teslamateapi:
    image: tobiasehlert/teslamateapi:latest
    restart: always
    depends_on:
      - database
    environment:
      - ENCRYPTION_KEY=XXX
      - DATABASE_USER=teslamate
      - DATABASE_PASS=XXX
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - MQTT_HOST=mosquitto
      - TZ=Europe/Berlin
      - API_TOKEN=XXX
      - ENABLE_COMMANDS=false
    ports:
      - 8080:8080

I execute docker composeas non-root user which is in the dockergroup. Using this user, I'm not able to change into the /rootdirectory of my docker host system ("Permission denied").

Since I'm not too familiar with docker, is the mentioned config.json part of the teslamateapi container or part of my docker configuration?

tobiasehlert commented 6 months ago

@bscx, I've created #274 that should address your issue. Could you test the fix by pulling tobiasehlert/teslamateapi: bug-273 to see if it works as expected?

bscx commented 6 months ago

Thank you! Already done, I can confirm it's working again! Great job!

tobiasehlert commented 6 months ago

hmmm.. something seems not to be fully working here now.. need to dig a little more.

tobiasehlert commented 6 months ago

@bscx, updated some more things on tobiasehlert/teslamateapi:bug-273. Please verify that it still works for you, I've added permission restriction on the binary file.

bscx commented 6 months ago

Pulled the image again (bug-273), rebuilt it, started it. Seems to be working fine!

tobiasehlert commented 6 months ago

Thanks for your report @bscx! 🚀