Building image in minikube got stuck

8/30/2019

I'm trying to deploy local image in minikube. This is what I'm doing:

  1. minikube start
  2. eval $(minikube docker-env)
  3. Trying to build image in minikube (build image -t my-image .), but it gets stuck at 2. fetching packages... line

I don't have any HTTP_PROXY, HTTPS_PROXY, NO_PROXY set. Anybody had such an issue?

Edit. This is my Dockerfile. It works fine. I can build, push, pull from remote docker registry. It only doesn't work, when I build image in minikube.

FROM node:10.16.2-alpine

WORKDIR /app/server

ADD package.json .

RUN apk --no-cache add --virtual .build build-base python && \
  yarn install && \
  npm rebuild bcrypt --build-from-source && \
  yarn cache clean && \
  apk del .build

ADD . .

EXPOSE 3000

CMD [ "yarn", "start" ]

This is docker build log in minikube:

Sending build context to Docker daemon    292MB
Step 1/7 : FROM node:10.16.2-alpine
 ---> 4f877c96a193
Step 2/7 : WORKDIR /app/server
 ---> Using cache
 ---> 71cd2676c364
Step 3/7 : ADD package.json .
 ---> Using cache
 ---> af5f79d46abf
Step 4/7 : RUN apk --no-cache add --virtual .build build-base python &&   yarn install &&   npm rebuild bcrypt --build-from-source &&   yarn cache clean &&   apk del .build
 ---> Running in c38695ed65b7
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/27) Installing binutils (2.31.1-r2)
(2/27) Installing libmagic (5.36-r0)
(3/27) Installing file (5.36-r0)
(4/27) Installing gmp (6.1.2-r1)
(5/27) Installing isl (0.18-r0)
(6/27) Installing libgomp (8.3.0-r0)
(7/27) Installing libatomic (8.3.0-r0)
(8/27) Installing mpfr3 (3.1.5-r1)
(9/27) Installing mpc1 (1.0.3-r1)
(10/27) Installing gcc (8.3.0-r0)
(11/27) Installing musl-dev (1.1.20-r5)
(12/27) Installing libc-dev (0.7.1-r0)
(13/27) Installing g++ (8.3.0-r0)
(14/27) Installing make (4.2.1-r2)
(15/27) Installing fortify-headers (1.0-r0)
(16/27) Installing build-base (0.5-r1)
(17/27) Installing libbz2 (1.0.6-r7)
(18/27) Installing expat (2.2.7-r0)
(19/27) Installing libffi (3.2.1-r6)
(20/27) Installing gdbm (1.13-r1)
(21/27) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(22/27) Installing ncurses-terminfo (6.1_p20190105-r0)
(23/27) Installing ncurses-libs (6.1_p20190105-r0)
(24/27) Installing readline (7.0.003-r1)
(25/27) Installing sqlite-libs (3.28.0-r0)
(26/27) Installing python2 (2.7.16-r1)
(27/27) Installing .build (0)
Executing busybox-1.29.3-r10.trigger
OK: 211 MiB in 43 packages
yarn install v1.17.3
info No lockfile found.
[1/4] Resolving packages...
warning bugsnag@2.4.3: All projects should upgrade to our universal JS notifier: "@bugsnag/js". See https://github.com/bugsnag/bugsnag-js/blob/master/UPGRADING.md for more details.
warning bugsnag > cuid > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
warning node-mailer@0.1.1: node-mailer is not maintained
warning jest > jest-cli > prompts > kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
warning jest > jest-cli > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning nest-cli > exists-sync@0.0.3: Please replace with usage of fs.existsSync
warning supertest > superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
-- user1726616
docker
kubernetes

1 Answer

9/2/2019

You can try to increase --network timeout parameter, adapting it in yarn command line within the shared Dockerfile as @Marc ABOUCHACRA mentioned in the comment:

yarn install --network-timeout 1000000

The issue seems to be very common and not related to minikube VM, just search for the details in this Stack thread.

-- mk_sta
Source: StackOverflow