Error creating custom docker image with python

Hi all,
I am getting the below error while creating custom docker image from base image using docker file. I also tried with Executor Image builder and command line but no success:

[+] Building 26.3s (9/9) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.82kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for registry.hub.knime.com/knime/knime-full:r-5.2.5-592 0.3s
=> CACHED [1/6] FROM registry.hub.knime.com/knime/knime-full:r-5.2.5-592@sha256:072dc2f10181388fd3b1ca821309f775c568cbfb3e82f4e9b4ecc031b20d8d13 0.0s
=> [2/6] RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates && rm -rf /var/lib/apt/lists/* 6.8s
=> [3/6] RUN apt-get update && apt-get install -y curl bzip2 && rm -rf /var/lib/apt/lists/* 14.6s
=> [4/6] RUN set -x && mkdir -p ~/.local/bin && curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C ${HOME}/.local/bin/ --st 3.8s
=> [5/6] RUN echo $'name: py310_knime # Name of the created environment\nchannels: # Repositories to search for packages\n- co 0.3s
=> ERROR [6/6] RUN set -x && micromamba env create -f /tmp/py310_knime.yml && micromamba install -y -n base conda -c conda-forge && micromamba clean 0.4s

[6/6] RUN set -x && micromamba env create -f /tmp/py310_knime.yml && micromamba install -y -n base conda -c conda-forge && micromamba clean -y --all:
0.391 + micromamba env create -f /tmp/py310_knime.yml
0.391 /usr/bin/bash: line 1: micromamba: command not found


Dockerfile:68

67 | ’ > /tmp/py310_knime.yml
68 | >>> RUN set -x &&
69 | >>> micromamba env create -f /tmp/py310_knime.yml &&
70 | >>> # legacy conda support
71 | >>> micromamba install -y -n base conda -c conda-forge &&
72 | >>> micromamba clean -y --all
73 | # END Python setup

ERROR: failed to solve: process “/usr/bin/bash -o pipefail -c set -x && micromamba env create -f /tmp/py310_knime.yml && micromamba install -y -n base conda -c conda-forge && micromamba clean -y --all” did not complete successfully: exit code: 127

Hi @Deepak261291,

Thanks for your message, It looks like you are trying to build the python environment on the Base Image. Please note that the Base KNIME Executor image does not contain conda setup by default. So to avoid the conda issue you can choose the below option.

  1. Change the Base image to Full Image + python(On the full image image Conda is already setup)
    (http://registry.hub.knime.com/knime/knime-full:r-5.2.5-592-with-python)
# Define the base image
FROM registry.hub.knime.com/knime/knime-full:r-5.2.5-592-with-python
  1. Or you can pass the below snippet to your docker file that will install the Conda Setup.
# START Conda setup
# install additional packages
USER root
RUN apt-get update && \
apt-get install -y curl bzip2 && \
rm -rf /var/lib/apt/lists/*
USER knime
SHELL [ "/usr/bin/bash", "-o", "pipefail" ,"-c" ]
RUN set -x && \
mkdir -p ~/.local/bin && \
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C ${HOME}/.local/bin/ --strip-components=1 bin/micromamba && \
$HOME/.local/bin/micromamba shell init -s bash -p ~/miniconda3
ENV MAMBA_ROOT_PREFIX=/home/knime/miniconda3
USER root
RUN ln -s /home/knime/.local/bin/micromamba /usr/local/bin/micromamba
USER knime
# legacy conda support
RUN micromamba install -y -n base conda -c conda-forge
# END Conda setup
  1. Or, with HUB 1.10 version onwards we have Executor Image Builder Data App that you can use to build your images and push it to your registry. Please refer the below links for the data app and the instructions on how to use it.

https://docs.knime.com/latest/business_hub_admin_guide/index.html#add-extension-docker-executor-images

Regards,
Nagarjun S

1 Like

Thanks @nagarjun36
It works well.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.