skip to Main Content

I’m new to docker. I’m wondering what is the wrong here? this is a basic react-project that i wanted to build a docker image from it according to a tutorial that i follow.

file structure

DockerFile

FROM node:14.16-alpine3.13
COPY . /app

I got this error when i enter this command docker build -t react-app .

$ docker build -t react-app .
[+] Building 9.4s (6/7)
 => [internal] load build definition from Dockerfile                       1.7s
 => => transferring dockerfile: 31B                                        0.8s
 => [internal] load .dockerignore                                          2.0s
 => => transferring context: 2B                                            0.7s
 => [internal] load metadata for docker.io/library/node:14.16-alpine3.13   5.3s
 => [auth] library/node:pull token for registry-1.docker.io                0.0s
 => ERROR [internal] load build context                                    2.3s
 => => transferring context: 309.99kB                                      2.1s
 => [1/2] FROM docker.io/library/node:14.16-alpine3.13@sha256:7021600941a  0.0s
------
 > [internal] load build context:
------
error from sender: open node_modules@babelplugin-bugfix-safari-id-destructurin
g-collision-in-function-expressionlib: Access is denied.

My docker version

$ docker version
Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:44:07 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.5.1 (74721)
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

!Important: I changed FROM node:alpine3.13 to FROM node:14.16-alpine3.13 after posting this question.

3

Answers


  1. Change

    FROM node:14.16-alpine3.13
    

    To

    FROM node:12
    

    that work in my case

    Login or Signup to reply.
  2. I have the same problem. After sign in (logging) at Docker Desktop, the problem was gone.

    Before sign in

    docker build -t my_ecom_ui .
    [+] Building 2.4s (6/8)
     => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s 
     => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s 
     => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s 
     => [internal] load metadata for docker.io/library/tomcat:8.5.82-jre8-openjdk                                                                                                                                                                                                                                      2.3s 
     => [auth] library/tomcat:pull token for registry-1.docker.io                                                                                                                                                                                                                                                      0.0s 
     => [1/3] FROM docker.io/library/tomcat:8.5.82-jre8-openjdk@sha256:bf1e414022830500ccace4d77dcc29017f69756225d0f4ca1477f09e8a5ce131                                                                                                                                                                                0.0s 
     => ERROR [internal] load build context                                                                                                                                                                                                                                                                            0.0s 
     => => transferring context: 87B                                                                                                                                                                                                                                                                                   0.0s 
    ------
     > [internal] load build context:
    ------
    

    After sign in

    docker build -t my_ecom_ui .
    [+] Building 1.7s (8/8) FINISHED
     => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s 
     => => transferring dockerfile: 171B                                                                                                                                                                                                                                                                               0.0s 
     => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s 
     => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s 
     => [internal] load metadata for docker.io/library/tomcat:8.5.82-jre8-openjdk                                                                                                                                                                                                                                      0.7s 
     => [1/3] FROM docker.io/library/tomcat:8.5.82-jre8-openjdk@sha256:bf1e414022830500ccace4d77dcc29017f69756225d0f4ca1477f09e8a5ce131                                                                                                                                                                                0.0s 
     => [internal] load build context                                                                                                                                                                                                                                                                                  0.6s 
     => => transferring context: 79.84MB                                                                                                                                                                                                                                                                               0.6s 
     => CACHED [2/3] COPY target/ecom_ui.war /usr/local/tomcat/webapps/                                                                                                                                                                                                                                                0.0s 
     => [3/3] COPY main.config.yml /usr/local/tomcat/webapps/                                                                                                                                                                                                                                                          0.2s 
     => exporting to image                                                                                                                                                                                                                                                                                             0.0s 
     => => exporting layers                                                                                                                                                                                                                                                                                            0.0s 
     => => writing image sha256:2370e8d59bc1b3b07c4d715f5e099e0e9ba2f37e49079cbd7f7b8f0821063aef                                                                                                                                                                                                                       0.0s 
     => => naming to docker.io/library/my_ecom_ui 
    
    enter code here
    
    Login or Signup to reply.
  3. Same issue, but I made a bandaid with:

    sudo chown $USER:$USER *
    

    The problem was really me being too fast and loose with docker volumes which caused some of the files/directories in the directory with Dockerfile to be owned by root instead of "me".

    The permanent fix for me is presumably to stop playing fast and loose with volume mounts.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search