I have been running the same drone build for over a year but now my docker builds are failing with the error EAI_AGAIN registry.npmjs.org.
This works if I manually build the docker container on the server drone runs on and it only fails when drone runs the docker compose file.
Why is the docker build failing to reach npmjs from inside fo drone but able to everywhere else?
Error
Step 8/22 : RUN npm install --no-shrinkwrap
---> Running in 767df1713756
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/apexcharts failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-22T17_26_11_042Z-debug.log
The command '/bin/sh -c npm install --no-shrinkwrap' returned a non-zero code: 1
time="2019-11-22T17:26:15Z" level=fatal msg="exit status 1"
.drone.yml
pipeline:
build:
image: node:10.16
commands:
- npm install
docker-master:
pull: true
image: plugins/docker:latest
repo: (omitted)
secrets: [ docker_username, docker_password ]
registry: (omitted)
tags: master
force_tag: true
when:
status: success
event: [ push ]
branch: master
DOCKERFILE
FROM node:10.16
RUN mkdir -p /usr/src/app
RUN mkdir -p /usr/src/app/files
RUN mkdir -p /usr/src/app/uploads
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
COPY package-lock.json /usr/src/app/
RUN npm install --no-shrinkwrap
COPY .babelrc /usr/src/app/
COPY gulpfile.babel.js /usr/src/app/
COPY constants.js /usr/src/app/
COPY webpack.config.js /usr/src/app/
COPY ./config /usr/src/app/config
COPY ./src /usr/src/app/src
COPY ./views /usr/src/app/views
COPY ./public /usr/src/app/public
RUN node_modules/.bin/gulp
CMD [ "npm", "start"]
Drone Config
version: '2'
services:
drone-server:
image: drone/drone:0.8
ports:
- 4000:8000
- 9000:9000
volumes:
- /opt/drone2:/var/lib/drone/
restart: always
environment:
- DRONE_OPEN=true
- DRONE_HOST=https://(omitted)
- DRONE_GITHUB=true
- DRONE_GITHUB_URL=(omitted)
- DRONE_GITHUB_CLIENT=(omitted)
- DRONE_GITHUB_SECRET=(omitted)
- DRONE_SECRET=(omitted)
- DRONE_ADMIN=(omitted)
drone-agent:
image: drone/agent:0.8
command: agent
restart: always
depends_on: [ drone-server ]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DOCKER_API_VERSION=1.40
- DRONE_SERVER=drone-server:9000
- DRONE_SECRET=(omitted)