Docker multi-stage builds

Am trying to use the “plugins/docker” plugin to build a docker-image based on a Dockerfile with a multi-stage build.

  1. node-image for building the app
  2. httpd-image for “hosting” the built files
    FROM node:6.7.0
    RUN mkdir /build
    COPY / /build/
    WORKDIR /build

    RUN npm install ....

    FROM httpd:2.4.29-alpine
    COPY --from=0 /build/public/ /usr/local/apache2/htdocs/
    COPY httpd.conf /usr/local/apache2/conf/httpd.conf

But I am getting what seems to be a DNS lookup error when building the app (accessing npm-registry via an internal proxy, who’s IP is registered in route53):

Error: tunneling socket could not be established, cause=getaddrinfo EAI_AGAIN

This does not fail when I build the app in a “normal” Drone build-step:


    image: node:6.7.0

Any clues as to how this can be solved?

Crap. It seems I was missing the docker.sock mount. That solved the issue.

      - /var/run/docker.sock:/var/run/docker.sock

I don’t think you should need to mount the docker socket, It seems more like a custom_dns problem

see similar issues

Yea I’m pretty certain that the Docker plugin uses Docker-in-Docker, not the Docker daemon on the host.