Docker Community Forums

Share and learn in the Docker community.

Alpine and apk add fails (hangs, killed)

Hi,
I’m trying to build a simple image with Alpine and some packages which exits in a strange way.
Purpose is to package a vue web application into a container.
Trying to build this Dockerfile:

FROM alpine:latest
RUN apk update && apk upgrade &&
apk add --no-cache bash git openssh
RUN apk add --update python krb5 krb5-libs gcc make g++ krb5-dev
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app/
RUN npm install
RUN npm install pm2 -g
WORKDIR /usr/src/app
EXPOSE 8080
CMD [ “pm2-runtime”,“start”,“ecosystem.config.js”,"–only",“dev” ]

Results in:

Sending build context to Docker daemon 131.2MB
Step 1/11 : FROM alpine:latest
—> b7b28af77ffe
Step 2/11 : RUN apk update && apk upgrade && apk add --no-cache bash git openssh
—> Running in 42f70425c414
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
v3.10.1-40-g92381611d0 [http://dl-cdn.alpinelinux.org/alpine/v3.10/main]
v3.10.1-48-g7a07264fca [http://dl-cdn.alpinelinux.org/alpine/v3.10/community]
OK: 10335 distinct packages available
OK: 6 MiB in 14 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/18) Installing ncurses-terminfo-base (6.1_p20190518-r0)
The command ‘/bin/sh -c apk update && apk upgrade && apk add --no-cache bash git openssh’ returned a non-zero code: 137

Also tried to manually do it results in the following (sometimes it hangs, sometimes it says “killed” after 1%:

$ docker run -it --rm alpine:3.7 /bin/sh
/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.3-111-g5865ea3a9f [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.3-78-g634dbf6dd0 [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 9052 distinct packages available
/ # apk upgrade
OK: 4 MiB in 13 packages
/ # apk add bash
(1/6) Installing pkgconf (1.3.10-r0)
(2/6) Installing ncurses-terminfo-base (6.0_p20171125-r1)
1% ### Killed

My host info:

Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:21:05 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:19:41 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683

Ubuntu version:

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release:18.04
Codename:bionic

Thanks in advance

Solved by upgrading my Ubuntu Bionic 18.04 to Disco 19.04. Something must have been really messed up but have no idea what.