pip getting killed in Docker

  docker, macos, out-of-memory, pip, python

I am building a Docker container based on python:3.7-slim-stretch (same problem also happens on python:3.7-slim-stretch), and it is getting Killed on

pip install --no-cache-dir --verbose /wheels/*

My Mac (OSX 10.15.7) has 64Gb of RAM, and plenty of disk space, so I have no idea why it is being killed. How can I find out? (I saw a suggestion to check /var/log/messages… but it doesn’t exist…) And then, what can I do about it?

(Also, interestingly, the initial pip wheel works perfectly fine.)

Just in case, here’s the Dockerfile:

###########
# BUILDER #
###########

FROM python:3.7-slim-stretch as builder

WORKDIR /usr/src/app

ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1

RUN apt update 
    && apt install -y build-essential mecab

COPY ./requirements.txt .
RUN pip install --upgrade pip 
    && pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt


#########
# FINAL #
#########

FROM python:3.7-slim-stretch

ENV HOME=/home/app APP_HOME=/home/app/web

RUN mkdir -p /home/app $APP_HOME 
    && addgroup --system app 
    && adduser --system --ingroup app app

WORKDIR $APP_HOME

COPY --chown=app:app --from=builder /usr/src/app/wheels /wheels
COPY --chown=app:app --from=builder /usr/src/app/requirements.txt .

RUN pip install --verbose --no-cache-dir /wheels/*

COPY --chown=app:app . $APP_HOME

USER app

ENTRYPOINT ["/home/app/web/entrypoint.sh"]

and requirements.txt:

aiofiles==0.6.0
alabaster==0.7.12
allennlp==0.9.0
attrs==20.3.0
Babel==2.9.0
blinker==1.4
blis==0.2.4
boto3==1.17.10
botocore==1.20.10
cached-property==1.5.2
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
conllu==1.3.1
cycler==0.10.0
cymem==2.0.5
dataclasses==0.6
docutils==0.16
editdistance==0.5.3
filelock==3.0.12
flaky==3.7.0
Flask==1.1.2
Flask-Cors==3.0.10
ftfy==5.9
gevent==21.1.2
greenlet==1.0.0
h11==0.12.0
h2==4.0.0
h5py==3.1.0
hpack==4.0.0
Hypercorn==0.11.2
hyperframe==6.0.0
idna==2.10
imagesize==1.2.0
importlib-metadata==3.4.0
iniconfig==1.1.1
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.3
jmespath==0.10.0
joblib==1.0.1
jsonnet==0.17.0
jsonpickle==2.0.0
kiwisolver==1.3.1
MarkupSafe==1.1.1
matplotlib==3.3.4
mecab-python3==0.996.5
mojimoji==0.0.11
murmurhash==1.0.5
nltk==3.5
numpy==1.20.1
numpydoc==1.1.0
overrides==3.1.0
packaging==20.9
parsimonious==0.8.1
Pillow==8.1.0
plac==0.9.6
pluggy==0.13.1
preshed==2.0.1
priority==1.3.0
protobuf==3.14.0
py==1.10.0
Pygments==2.8.0
pyparsing==2.4.7
pytest==6.2.2
python-dateutil==2.8.1
pytorch-pretrained-bert==0.6.2
pytorch-transformers==1.1.0
pytz==2021.1
Quart==0.14.1
regex==2020.11.13
requests==2.25.1
responses==0.12.1
s3transfer==0.3.4
sacremoses==0.0.43
scikit-learn==0.24.1
scipy==1.6.1
sentencepiece==0.1.95
six==1.15.0
snowballstemmer==2.1.0
spacy==2.1.9
Sphinx==3.5.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sqlparse==0.4.1
srsly==1.0.5
tensorboardX==2.1
thinc==7.0.8
threadpoolctl==2.1.0
tokenizers==0.8.1rc1
toml==0.10.2
torch==1.7.1
tqdm==4.57.0
transformers==3.0.2
typing-extensions==3.7.4.3
Unidecode==1.2.0
urllib3==1.26.3
wasabi==0.8.2
wcwidth==0.2.5
Werkzeug==1.0.1
word2number==1.1
wsproto==1.0.0
zipp==3.4.0
zope.event==4.5.0
zope.interface==5.2.0

Source: Docker Questions

LEAVE A COMMENT