docker/getting-started

ERROR: failed to solve: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 139

jl-unitedlocating opened this issue · 2 comments

Running the build command in the getting-started tutorial part 2 produced the following error:

 => ERROR [4/4] RUN yarn install --production
------
 > [4/4] RUN yarn install --production:
------
Dockerfile:6
--------------------
   4 |     WORKDIR /app
   5 |     COPY . .
   6 | >>> RUN yarn install --production
   7 |     CMD ["node", "src/index.js"]
   8 |     EXPOSE 3000
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 139

As a workaround I found that changing FROM node:18-alpine to FROM node:18 does work. I am having the same issue with other Dockerfiles I am attempting to use with FROM node:18-alpine.

The full output from docker build -t getting-started . is :

[+] Building 2.8s (12/12) FINISHED                                                                                                                                                                                            docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 182B                                                                                                                                                                                                    0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1                                                                                                                                                               0.9s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                                                                                                                        0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:dbbd5e059e8a07ff7ea6233b213b36aa516b4c53c645f1817a4dd18b83cbea56                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine                                                                                                                                                                       0.8s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                         0.0s
 => [1/4] FROM docker.io/library/node:18-alpine@sha256:80338ff3fc4e989c1d5264a23223cec1c6014e812e584e825e78d1a98d893381                                                                                                                 0.0s
 => [internal] load build context                                                                                                                                                                                                       0.1s
 => => transferring context: 7.01MB                                                                                                                                                                                                     0.1s
 => CACHED [2/4] WORKDIR /app                                                                                                                                                                                                           0.0s
 => [3/4] COPY . .                                                                                                                                                                                                                      0.2s
 => ERROR [4/4] RUN yarn install --production                                                                                                                                                                                           0.4s
------
 > [4/4] RUN yarn install --production:
------
Dockerfile:6
--------------------
   4 |     WORKDIR /app
   5 |     COPY . .
   6 | >>> RUN yarn install --production
   7 |     CMD ["node", "src/index.js"]
   8 |     EXPOSE 3000
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn install --production" did not complete successfully: exit code: 139

docker version output:

Client:
 Cloud integration: v1.0.35+desktop.13
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:16:45 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:01 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info output:

Client:
 Version:    26.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.13.1-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.26.1-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.27
    Path:     /usr/local/lib/docker/cli-plugins/docker-debug
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /usr/local/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.23
    Path:     /usr/local/lib/docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     /usr/local/lib/docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.1.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.6.3
    Path:     /usr/local/lib/docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 26.0.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.146.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 11.6GiB
 Name: docker-desktop
 ID: 38aaea53-54c8-40fa-8592-5184dcbdbf1d
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///var/run/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile

found the same issue on docker 101 tutorial documentation,
docker run -dp 80:80 docker/getting-started
need to fix it in this container also .
https://www.docker.com/101-tutorial/

To fix it delete the package.json file and re-run the command.
I deleted the package.json file and changed the command to npm install and it worked!