4

docker build command is not building the docker machine I am trying to make. I searched all over the net, I couldn't find an answer. Below is my dockerfile. I think the problem starts with fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz

FROM python:3.5-alpine
MAINTAINER ******* <code@******.com>


ENV INSTALL_PATH /web
RUN mkdir -p ${INSTALL_PATH}
COPY . ${INSTALL_PATH}
WORKDIR ${INSTALL_PATH}

RUN apk add --no-cache --virtual .build-deps build-base libffi-dev postgresql-dev uwsgi-python supervisor \
        && pip install --trusted-host github.com --process-dependency-links -e . \
        && find /usr/local \( -type d -a -name test -o -name tests \) \
           -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' + \
        && runDeps="$(scanelf --needed --nobanner --recursive /usr/local \
           | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
           | sort -u | xargs -r apk info --installed | sort -u \
        )" \
        && apk add --virtual .rundeps $runDeps && apk del .build-deps

The output is below:

Sending build context to Docker daemon  11.26kB
Step 1/7 : FROM python:3.5-alpine
 ---> 9691bd606b6d
Step 2/7 : MAINTAINER ******* <code@*******.com>
 ---> Using cache
 ---> 71df6ccd567e
Step 3/7 : ENV INSTALL_PATH /web
 ---> Using cache
 ---> 06ced81d3941
Step 4/7 : RUN mkdir -p ${INSTALL_PATH}
 ---> Using cache
 ---> ad857704376d
Step 5/7 : COPY . ${INSTALL_PATH}
 ---> Using cache
 ---> c6ddc57309a2
Step 6/7 : WORKDIR ${INSTALL_PATH}
 ---> Using cache
 ---> 62f0dbfaa3eb
Step 7/7 : RUN apk add --no-cache --virtual .build-deps build-base libffi-dev postgresql-dev uwsgi-python supervisor         && pip install --trusted-host github.com --process-dependency-links -e .         && find /usr/local \( -type d -a -name test -o -name tests \)            -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' +         && runDeps="$(scanelf --needed --nobanner --recursive /usr/local            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }'            | sort -u | xargs -r apk info --installed | sort -u         )"         && apk add --virtual .rundeps $runDeps && apk del .build-deps
 ---> Running in 1abedb8ada2a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
  .build-deps-0:
    masked in: cache
    satisfies: world[.build-deps]
  build-base (missing):
    required by:
  libffi-dev (missing):
    required by:
  postgresql-dev (missing):
    required by:
  uwsgi-python (missing):
    required by:
  supervisor (missing):
    required by:
The command '/bin/sh -c apk add --no-cache --virtual .build-deps build-base libffi-dev postgresql-dev uwsgi-python supervisor         && pip install --trusted-host github.com --process-dependency-links -e .         && find /usr/local \( -type d -a -name test -o -name tests \)            -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' +         && runDeps="$(scanelf --needed --nobanner --recursive /usr/local            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }'            | sort -u | xargs -r apk info --installed | sort -u         )"         && apk add --virtual .rundeps $runDeps && apk del .build-deps' returned a non-zero code: 6

3 Answers3

2

In the fetch process, dns name server is not able to resolve the address. The reason might be there is a firewall

Ubuntu has google dns servers in /etc/default/docker file

DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

There's more details to resolve the dns problem here Docker - Network calls fail during image build on corporate network

corning
  • 361
  • 5
  • 20
1

Separate each command to see which of them is exactly causing the problem. Instead of concatenate one after another using &&. Put a RUN command with the apk add only for one package and then another in the same way.

In this way you'll see which of them is exactly causing the problem.

This is only for "debug". After solving the problem you can put them all togheter again.

OscarAkaElvis
  • 5,384
  • 4
  • 27
  • 51
  • I get your way of thinking, it's great. However, if you check, it fails in the `RUN apk add` part which consists of building the image which is the first step to be done when working with docker. What I am looking for, is someone who can give me a hint on how to fix this issue. Thanks – Fabrice Kwizera May 07 '17 at 12:55
  • 1
    But you can split your first command from install libffi-dev postgresql-dev uwsgi-python supervisor in one RUN apk command per each one. Do it to see exactly which of them is causing you the trouble – OscarAkaElvis May 07 '17 at 17:15
1

For me the issue was resolved by turning off my VPN.

irbanana
  • 860
  • 12
  • 19