Issue
I am using micromamba with a large set of both conda and pip dependencies. When running docker build
, the micromamba install
step fails to install some dependencies, but the docker build
continues without error, leading to an image missing a number of dependencies.
I'm using Docker Desktop on Mac, and I noticed that increasing the memory resources for Docker from the default of 2.0GB up to 2.5GB results in successful build, so it seems like insufficient memory is causing the micromamba install
failure.
Desired behavior
The main issue is that the docker build
completes successfully even though micromamba failed to install all the packages, resulting in a broken image. Ideally, micromamba would cause the build to fail.
Details
My dockerfile:
# syntax=docker/dockerfile:1
FROM --platform=linux/amd64 mambaorg/micromamba:0.13.1
COPY environment-lock.yml /environment-lock.yml
RUN --mount=type=cache,target=/opt/conda/pkgs --mount=type=cache,target=/root/.cache \
micromamba install -y --file /environment-lock.yml
The environment-lock.yml is very large, and includes both conda and pip dependencies. I tried paring it down, but it was hard to reproduce the failure with a more minimal list. Let me know if you want me to share the full list.
Error
With --progress plain
, I see the following output from docker build
while micromamba is in the middle of installing pip dependencies specified in environment-lock.yml (this is after the conda deps were installed):
[...]
#9 441.2 Collecting tensorboard-plugin-wit==1.8.0
#9 441.2 Downloading tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
#9 442.7 Collecting tensorflow==2.5.0
#9 442.7 Downloading tensorflow-2.5.0-cp38-cp38-manylinux2010_x86_64.whl (454.4 MB)
#9 466.3 /tmp/mambafVPPFiskWCz: line 4: 2363 Killed /opt/conda/bin/pip install absl-py==0.11.0 apache-beam==2.30.0 [...a bunch of other pip packages...] xarray==0.16.2 --no-input
#9 DONE 466.7s
With some random poking, I found an example /tmp/mamba* file that looked like this:
lib/python3.8/site-packages/ansiwrap/__init__.py
lib/python3.8/site-packages/ansiwrap/ansistate.py
lib/python3.8/site-packages/ansiwrap/core.py
eval "$('/bin/micromamba' 'shell' 'hook' '-s' 'bash' '-p' '/opt/conda')"
Solution(?)
It seems like the "Line 4: ... Killed" is referring to the final line in the script mentioned above. I think the problem is that the system is terminating the command on line 4 due to running out of memory, but this failure isn't propagated to the RUN micromamba install ...
, so the docker build
succeeds.
I think including set -e
or using exec
in this script would cause the error to propagate to micromamba.
Misc
Some instances of people saying they needed to increase the memory limits for docker build: