# Dockerfile RUN apk add - Permission denied

**URL:** <https://discourse.nodered.org/t/dockerfile-run-apk-add-permission-denied/49746>\
**Category:** General\
**Created:** [15 August 2021 12:51 UTC](https://discourse.nodered.org/t/dockerfile-run-apk-add-permission-denied/49746 "2021-08-15T12:51:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![novski](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/novski/32/23243_2.png) [@novski](https://discourse.nodered.org/u/novski)\
**Post date:** [15 August 2021 12:51 UTC](https://discourse.nodered.org/t/dockerfile-run-apk-add-permission-denied/49746/1 "2021-08-15T12:51:13Z")

</div>

As of [this Problem](https://discourse.nodered.org/t/http-request-node-does-not-work-with-hostname-only-ip/49612) 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:**

```auto
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:**

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

```

**output:**

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 October 2021 12:52 UTC](https://discourse.nodered.org/t/dockerfile-run-apk-add-permission-denied/49746/2 "2021-10-14T12:52:00Z")

</div>

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