Can no longer build docker images (returned a non-zero code: 239)

All of my build steps that build docker images are failing since yesterday. This is pretty perplexing as the build configuration hasn’t changed and it worked for weeks up until yesterday.

The relevant config looks like this:

publish:
    docker:
      - image: docker:19.03
    resource_class: medium
    working_directory: ~/repo
    steps:
      - attach_workspace:
          at: ~/repo
      - setup_remote_docker
      - run:
          name: build docker image
          command: |
            TAG=$CIRCLE_BUILD_NUM_DOCKER
            IMAGE_NAME=blah
            docker build -t $IMAGE_NAME:$TAG -t $IMAGE_NAME:latest .

This is happening across 4 different projects and they all fail while attempting to install yarn via NPM

Step 1/12 : FROM node:10-alpine as build
10-alpine: Pulling from library/node
e9fa308999cb: Waiting
69ff64b59cc9: Downloading 15.42MB/22.43MB
69ff64b59cc9: Extracting 4.588MB/22.43MB
69ff64b59cc9: Extracting 15.6MB/22.43MB
69ff64b59cc9: Extracting 19.73MB/22.43MB
69ff64b59cc9: Extracting 22.43MB/22.43MB
Digest: sha256:2d43b54c1d90b8a3102ee78d70aa62f02c41f5327dd70745576884a5f5a38f15
Status: Downloaded newer image for node:10-alpine
—> 8cb0238efebf
Step 2/12 : WORKDIR /app
—> 44f8ab2e9a08
Removing intermediate container fca7f7d18cee
Step 3/12 : COPY . /app
—> 334f8367ada1
Step 4/12 : RUN npm install -g -s --no-progress yarn && rm -rf node_modules && yarn install && yarn cache clean
—> Running in 4180e26f37c4
The command ‘/bin/sh -c npm install -g -s --no-progress yarn && rm -rf node_modules && yarn install && yarn cache clean’ returned a non-zero code: 239

Exited with code exit status 239

I can build the image on my local machine without issue. I’ve tried googling for docker error code 239 but have come up empty. Since it used to work reliably and still works locally, I’m assuming that the problem is either with my CircleCI config (e.g. I’m doing something that is deprecated and someone flipped the switch to end support yesterday) or there is an CircleCI issue/bug.

i am experiencing the same issue. Were you able to find the cause? seems a bunch of node images were updated 4 days ago, id say the issue is there somewhere

ok hope this helps, but managed to fix our issue.
we used docker:stable-dind in the ci which then runs node:12-alpine (dockerfile).
the issue was using: npm install -g -s --no-progress yarn@1.9.4
when i changed to just: npm install yarn it seemed to just work

I didn’t have time to look further into the issue since it isn’t a blocker at the moment. My Dockerfile is using -g -s --no-progress flags as well. I just tried your solution and it seems to fix the issue. Not sure why it randomly stopped working when using those npm flags but I’ll take it. Thanks for the help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.