MiguelNdeCarvalho / speedtest-exporter

Speedtest Exporter made in python using the official speedtest bin
https://docs.miguelndecarvalho.pt/projects/speedtest-exporter/
GNU General Public License v3.0
197 stars 56 forks source link

operation not permitted running in docker on raspberry pi. #167

Open sgmoore opened 2 years ago

sgmoore commented 2 years ago

I'm posting this just in case anyone else has a similar issue.

I have been running this for a while, but after doing a docker-compose pull, the container was not starting and the logs had the operation not permitted message coming from logging init

I was able to get around this by adding privileged : true to the speedtest service section of the docker-compose.yml

Not sure what the exact permissions required are.

MiguelNdeCarvalho commented 2 years ago

Hey,

@sgmoore sorry for the late response, can you give me your docker-compose.yml content please? It should work without the privileged option enabled.

Thanks, MiguelNdeCarvalho

sgmoore commented 2 years ago

docker-compose.zip

Attached is my current docker-compose.yml file

The speedtest service block is


  speedtest:
    tty: true
    stdin_open: true
    expose:
      - 9798
    ports:
      - 9798:9798
    image: miguelndecarvalho/speedtest-exporter
    restart: always
    networks:
      - back-tier
    cap_add:
      - NET_ADMIN
      - NET_RAW
    privileged : true
    dns:
      - 1.1.1.1
      - 8.8.8.8

The cap_add section was added to try to fix the problem (but didn't), and then privileged : true was added and did fix the problem. The dns entries were added later.

Punkado commented 2 years ago

Hello,

I can confirm the same problem happening here, only a privileged container works, the full error message:

Traceback (most recent call last): File "/app/exporter.py", line 4, in <module> import logging File "/usr/local/lib/python3.10/logging/__init__.py", line 57, in <module> _startTime = time.time() PermissionError: [Errno 1] Operation not permitted

Using the older version v3.5.2 didn't help.