Dockerfile RUN apk add - Permission denied

As of this Problem I changed my docker-compose to take the Dockerfile instead of directly nodered/node-red:latest and added a RUN in to my Dockerfile to add a package, but that fails because of Permissions denied.
What do I have to do, to install an aditional package in the same container as node-red?

docker-compose.yaml:

version: "3.7"

services:
  node-red:
    build:
       context: .
       dockerfile: Dockerfile
    environment:
      - 'TZ=Europe/Zurich'
      - 'NODE_ENV=production'
    network_mode: host
    ports:
      - '1880:1880'
    volumes:
      - 'node-red-data:/data'
    restart: 'always'

volumes:
  node-red-data:

Dockerfile:

FROM nodered/node-red:latest
RUN apk update \
    apk add avahi

output:

$ docker-compose up
Building node-red
Step 1/2 : FROM nodered/node-red:latest
 ---> db209923532e
Step 2/2 : RUN apk update     apk add avahi
 ---> Running in bf2b984ce393
ERROR: Unable to lock database: Permission denied
ERROR: Failed to open apk database: Permission denied
ERROR: Service 'node-red' failed to build : The command '/bin/sh -c apk update     apk add avahi' returned a non-zero code: 99

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.