homey icon indicating copy to clipboard operation
homey copied to clipboard

ERROR in app: Exception on /dockerList [GET]

Open Ronaldvr opened this issue 3 years ago • 6 comments

Not sure why but getting this error:

[2022-02-24 12:30:29,072] ERROR in app: Exception on /dockerList [GET] homey-api | Traceback (most recent call last): homey-api | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app homey-api | response = self.full_dispatch_request() homey-api | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request homey-api | rv = self.handle_user_exception(e) homey-api | File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function homey-api | return cors_after_request(app.make_response(f(*args, **kwargs))) homey-api | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request homey-api | rv = self.dispatch_request() homey-api | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request homey-api | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) homey-api | File "/code/app.py", line 95, in dockerList homey-api | return jsonify(dockerAPI.listContainers()) homey-api | File "/code/modules/docker_api.py", line 20, in listContainers homey-api | for c in self.client.api.containers(all=True): homey-api | AttributeError: 'api' object has no attribute 'client'

Ronaldvr avatar Feb 24 '22 12:02 Ronaldvr

Assuming this was run on straight Linux - do you have docker-py or an old version of docker-compose installed alongside homey-api's requirements? The docker-py module conflicts with homey's requirement docker and would cause this error

If this error came from Docker let me know and I will look deeper into it

vlfldr avatar Feb 28 '22 04:02 vlfldr

Hello, it was within the docker. Ican post the docker compose i used later today

Ronaldvr avatar Feb 28 '22 08:02 Ronaldvr

Sorry got distracted:

version: "3.1"

Please refer to README.md before running docker-compose up

services: homey-api: container_name: homey-api hostname: homey-api image: vlfldr/homey-api:latest user: "${HOMEY_API_DOCKER_USER_ID}:${HOMEY_API_DOCKER_GROUP_ID}" env_file: .env ports: - "9101:9101" volumes: - /var/run/docker.sock:/var/run/docker.sock - ./:/code/config

homey: container_name: homey hostname: homey image: vlfldr/homey:latest ports: - "11080:80" volumes: - ./:/app/data depends_on: - "homey-api"

Ronaldvr avatar Mar 06 '22 17:03 Ronaldvr

Thanks for the info. I can't reproduce inside Docker so far

  • Windows or Linux host?
  • If Linux host - is the socket located at the default location (/var/run/docker.sock?)
  • If Linux host - can the user corresponding to HOMEY_API_DOCKER_USER_ID run docker commands without error?
  • If Windows host - add an extra slash to the host Docker socket path & change user as described in readme

vlfldr avatar Mar 07 '22 18:03 vlfldr

I was having a similar issue as well. In my case, the Docker Group ID inside the example .env file (997) was not correct for my system, and Homey could thus not bind to the Docker socket. Assuming your user is in the Docker group (sudo usermod -aG docker [your-username], log out and then log back in), run the id command in the terminal. The first entry (that looks like uid=XXXX([your-username])) is your user ID. The XXXX is the number you need to put in the .env file, in the HOMEY_API_DOCKER_USER_ID entry. The output of the id command should also have an entry that looks like YYY(docker). That entry is the Docker group id. The YYY is the number you need to put in the .env file, in the HOMEY_API_DOCKER_GROUP_ID entry. If there is no YYY(docker) entry in the output of the id command, it means that your user does not belong in the Docker group.

homelab-addict avatar Mar 07 '22 21:03 homelab-addict

Thanks for the excellent explanation and walkthrough, @homelab-addict.

Leaving this open for now, please confirm/deny the ID mismatch theory if you get a chance @Ronaldvr

vlfldr avatar Mar 14 '22 03:03 vlfldr