El_Merendero
El_Merendero

Reputation: 699

Docker Image Build Fails with "Permission denied" Errors on macOS [Payara/micro:5.2021.9]

I'm encountering an issue while building a Docker image using the payara/micro:5.2021.9 base image on macOS Ventura 13.5 with Docker v24.0.7 and Docker Desktop v4.26.1.

Dockerfile:

FROM payara/micro:5.2021.9

USER root

RUN apk update

Build Command:

docker build -t test -f Dockerfile . && docker run -it test

Error Message:

[+] Building 1.0s (5/5) FINISHED                                                                                                                                                   docker:desktop-linux
=> [internal] load .dockerignore                                                                                                                                                                  0.0s
=> => transferring context: 2B                                                                                                                                                                    0.0s
=> [internal] load build definition from Dockerfile                                                                                                                                               0.0s
=> => transferring dockerfile: 2.08kB                                                                                                                                                             0.0s
=> [internal] load metadata for docker.io/payara/micro:5.2021.9                                                                                                                                   0.6s
=> CACHED [1/2] FROM docker.io/payara/micro:5.2021.9@sha256:1b163a9a7c4277173b4be460bba1e09d8402183a91777d16d676655c10410b00                                                                      0.0s
=> ERROR [2/2] RUN apk update                                                                                                                                                                     0.5s
------                                                                                                                                                                                                  
> [2/2] RUN apk update:                                                                                                                                                                                
0.119 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz                                                                                                                     
0.254 140737488350024:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914:                                                               
0.255 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/main: Permission denied                                                                                                                        
0.255 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: No such file or directory                                                                                                     
0.255 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
0.333 140737488350024:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914:
0.340 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/community: Permission denied
0.340 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: No such file or directory
0.341 fetch https://repos.azul.com/zulu/alpine/x86_64/APKINDEX.tar.gz
0.452 140737488350024:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914:
0.453 ERROR: https://repos.azul.com/zulu/alpine: Permission denied
0.453 WARNING: Ignoring https://repos.azul.com/zulu/alpine: No such file or directory
0.453 3 errors; 34 distinct packages available
------
Dockerfile:9
--------------------
  7 |     USER root
  8 |     
  9 | >>> RUN apk update
--------------------
ERROR: failed to solve: process "/bin/sh -c apk update" did not complete successfully: exit code: 3

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/p1qsaohius4p99y1kay7shc5l

I'm receiving three "Permission denied" errors when trying to update the package list within the container. Could someone help me understand the cause of these errors and suggest potential solutions?

Update 1

I tried to modify the docker image in this way in order to test its functioning by disabling the ssl verification:

FROM payara/micro:5.2021.9

USER root

RUN apk --no-cache --update add --virtual build-dependencies --allow-untrusted
RUN apk update

In this case the first RUN is executed successfully. The second one always generates the same error.

Update 2

I'm starting to think that maybe the problem is with the Alpine distribution as I tried to create the following Dockerfile:

FROM adoptopenjdk/openjdk8:alpine
RUN apk update

I ran it with the following command:

docker build --platform=linux/amd64 -t test -f Dockerfile . && docker run -it test

and I got the following output:

[+] Building 1.6s (5/5) FINISHED                                                                                                                                      docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                       0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 2.18kB                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/adoptopenjdk/openjdk8:alpine                                                                                                               1.2s
 => CACHED [1/2] FROM docker.io/adoptopenjdk/openjdk8:alpine@sha256:05973053a0aa55d3b4bcaf194d98568bdb3fbea47ad3783a0d923b43e0f4c77a                                                  0.0s
 => ERROR [2/2] RUN apk update                                                                                                                                                        0.4s
------                                                                                                                                                                                     
 > [2/2] RUN apk update:                                                                                                                                                                   
0.127 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
0.270 140737488350024:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1919:
0.272 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/main: Permission denied
0.272 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: No such file or directory
0.272 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
0.343 140737488350024:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1919:
0.344 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/community: Permission denied
0.344 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: No such file or directory
0.344 2 errors; 17 distinct packages available
------
Dockerfile:14
--------------------
  12 |     
  13 |     FROM adoptopenjdk/openjdk8:alpine
  14 | >>> RUN apk update
  15 |     
  16 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apk update" did not complete successfully: exit code: 2

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/xzbikn2f9xkr04cdb3w40a808

However, if I try to use the debian distribution:

FROM adoptopenjdk/openjdk8
RUN apt update

The problem is resolved and the container is initialized correctly. At this point, how can I create a docker image in debian with Payara micro 5.2021.9?

Upvotes: 0

Views: 1606

Answers (0)

Related Questions