Unstable docker experience

With a very minimal Dockerfile like this:

FROM node:18.12

WORKDIR /app

RUN npm install spago parcel purescript

running docker build . --no-cache 10 times resulted in a successful build 6 times, but failed 4 times with

Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM node:18.12
 ---> e390ceb99781
Step 2/3 : WORKDIR /app
 ---> Running in ed031fde8c7d
Removing intermediate container ed031fde8c7d
 ---> 03d85534d775
Step 3/3 : RUN npm install spago parcel purescript
 ---> Running in 96f49dffa715
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm notice 
npm notice New major version of npm available! 8.19.2 -> 9.1.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.1.2>
npm notice Run `npm install -g npm@9.1.2` to update!
npm notice 
npm ERR! code 1
npm ERR! path /app/node_modules/purescript
npm ERR! command failed
npm ERR! command sh -c -- install-purescript --purs-ver=0.15.6
npm ERR! [ SUCCESS ] Check if a prebuilt 0.15.6 binary is provided for linux (384ms)
npm ERR! [ SUCCESS ] Download the prebuilt PureScript binary (479ms)
npm ERR! [ FAILURE ] Verify the prebuilt binary works correctly
npm ERR! Error: spawn ETXTBSY
npm ERR!     at ChildProcess.spawn (node:internal/child_process:413:11)
npm ERR!     at spawn (node:child_process:743:9)
npm ERR!     at execFile (node:child_process:341:17)
npm ERR!     at node:child_process:235:21
npm ERR!     at Object.complete (/app/node_modules/purescript-installer/download-or-build-purescript/index.js:182:31)
npm ERR!     at notifySubscription (/app/node_modules/zen-observable/lib/Observable.js:145:18)
npm ERR!     at onNotify (/app/node_modules/zen-observable/lib/Observable.js:179:3)
npm ERR!     at SubscriptionObserver.complete (/app/node_modules/zen-observable/lib/Observable.js:245:7)
npm ERR!     at /app/node_modules/purescript-installer/dl-tar/index.js:222:15
npm ERR!     at /app/node_modules/purescript-installer/cancelable-pump/index.js:34:3
npm ERR!     at node:internal/util:453:5
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! 
npm ERR! See troubleshooting suggestions in https://github.com/purescript/purescript/blob/master/INSTALL.md
npm ERR! 
npm ERR! ↓ Fallback: building from source
npm ERR! 
npm ERR! [ FAILURE ] Check if 'stack' command is available
npm ERR! Error: Command failed with exit code 2 (ENOENT): stack --allow-different-user --numeric-version
npm ERR! spawn stack ENOENT
npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR!     at onErrorNT (node:internal/child_process:476:16)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! 
npm ERR! See troubleshooting suggestions in https://github.com/purescript/purescript/blob/master/INSTALL.md

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-27T08_15_29_006Z-debug-0.log
The command '/bin/sh -c npm install spago parcel purescript' returned a non-zero code: 1

This is for PureScript 0.15.6. I’m unsure whether this should be considered a bug or not. On the one hand, it seems like a node/npm thing. On the other hand, it does affect PureScript specifically. I haven’t encountered any problems running npm install spago parcel purescript on my local machine.

It should, perhaps, be noted, that I get similar results with node:18.12-slim, node:18.12-alpine, node:19.1, when running npm install -g npm@9.1.2 before, and with a more elaborate dockerfile from debian:bullseye using nvm.

2 Likes

Hi - I understand that this is unfortunate and although I don’t have a solution or even an idea what this could be at the moment I usually create a image with those preinstalled - I think this could be a workaround for you - there are quite a few on docker hub too if you don’t want to do it yourself (of course there is AFAIK no official one so I guess the question is how long those stay around)

1 Like

This issue has been reported here:

That’d be the best place to coordinate a fix.

Oh, great! I was looking for existing issues in the wrong project. Thanks for pointing me in the right direction!

1 Like