Docker Community Forums

Share and learn in the Docker community.

Same Dockerfile no longer build the image

Hello Docker community,
I am kind a noob (still learning) but hoping to get some help.
Few weeks ago, I followed a tutorial building images
My environment was
Windows 10
Node –version 14.17.1
Npm –version 7.17.1

Stage 0, “build-stage”, based on Node.js, to build and compile the frontend

FROM node:latest as build-stage
COPY package*.json /app/
RUN npm install
COPY ./ /app/
ARG configuration=production
RUN npm run build – --output-path=./dist/out --configuration $configuration

Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx

FROM nginx:1.15
#Copy ci-dashboard-dist
COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html
#Copy default nginx configuration to production sb
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf

Imaged built successfully
Last week I could no longer build the same image. Searching Mr. google, there were many recommendations, including upgrade to node 14.18.1. that did not work either, luckily, I had a snapshot of windows but to my surprised that did not work either with same error.
I have completely removed/uninstall everything (control panel, folders, registries–reboot) and re-install latest
Node -v v16.13.1
npm -v 7.19.1
BUT same error

=> [build-stage 5/6] COPY ./ /app/ 15.8s
=> ERROR [build-stage 6/6] RUN npm run build – --output-path=./dist/out --configuration production 17.2s

[build-stage 6/6] RUN npm run build – --output-path=./dist/out --configuration production:
#14 2.906
#14 2.906 > angular-demo@0.0.0 build
#14 2.906 > ng build “–output-path=./dist/out” “–configuration” “production”
#14 2.906
#14 2.983 Node.js version v17.3.0 detected.
#14 2.983 Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see Releases | Node.js.
#14 7.044 - Generating browser application bundles (phase: setup)…
#14 16.49 node:internal/crypto/hash:67
#14 16.49 this[kHandle] = new _Hash(algorithm, xofLen);
#14 16.49 Error: error:0308010C:digital envelope routines::unsupported
#14 16.49 at new Hash (node:internal/crypto/hash:67:19)
#14 16.49 at Object.createHash (node:crypto:130:10)
#14 16.49 at BulkUpdateDecorator.hashFactory (/app/node_modules/webpack/lib/util/createHash.js:145:18)
#14 16.49 at BulkUpdateDecorator.update (/app/node_modules/webpack/lib/util/createHash.js:46:50)
#14 16.49 at RawSource.updateHash (/app/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:64:8)
#14 16.49 at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:868:17)
#14 16.49 at handleParseResult (/app/node_modules/webpack/lib/NormalModule.js:934:10)
#14 16.49 at /app/node_modules/webpack/lib/NormalModule.js:1026:4
#14 16.49 at processResult (/app/node_modules/webpack/lib/NormalModule.js:743:11)
#14 16.49 at /app/node_modules/webpack/lib/NormalModule.js:807:5 {
#14 16.49 opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
#14 16.49 library: ‘digital envelope routines’,
#14 16.49 reason: ‘unsupported’,
#14 16.49 code: ‘ERR_OSSL_EVP_UNSUPPORTED’
#14 16.49 }
#14 16.49
#14 16.49 Node.js v17.3.0

executor failed running [/bin/sh -c npm run build – --output-path=./dist/out --configuration $configuration]: exit code: 1

The error shows node detected v17.3.0, not sure if this is part of the root-casue
Many thanks in advanced

Hello and welcome,

found this as searching for your error: Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED - Stack Overflow
To use the latest 16.x-version of nodejs you can modify your Dockerfile's first list to FROM node:16 as buld-stage

1 Like

You should never use the latest versions in a Dockerfile. Use as specific version as you can. Usually a new patch version doesn’t breake compatibility but it can, so if you really want to be sure your docker build will work the same way every time, use the most specific version like FROM node:16.13.1-stretch which also contains the variant. Then the update will require a little more work but you won’t have accidental updates.

Note: Probably someone will write that the above reference is not necessarily the most specific. You could use the digest, but it is not really common practice in a Dockerfile. docker pull | Docker Documentation


I tried both recommendations and worked fine.

Your help is greatly appreciated!!!