How to have miniconda work properly with docker -- especially naming my conda envs from within the dockerfile?

Viewed 19

I want to have a docker container where I can create the names of my containers myself. I found this works:

FROM ubuntu:20.04

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    ssh \
    git \
    m4 \
    libgmp-dev \
    opam \
    wget \
    ca-certificates \
    rsync \
    strace

RUN useradd -m bot
WORKDIR /home/bot
USER bot

RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh  \
    && bash Miniconda3-latest-Linux-x86_64.sh -b -f
ENV PATH="/home/bot/miniconda3/bin:${PATH}"
RUN conda create -n pycoq python=3.9 -y
# somehow this "works" but conda isn't fully aware of this. Fix later?
ENV PATH="/home/bot/miniconda3/envs/pycoq/bin:${PATH}"

but seems very hacky. In fact if I start from the continuumio/miniconda3 it doesn't seem to work properly e.g. I can't create my conda environments from within the Dockerfile. Does someone know how to fix this?

Ideally I start from some official docker conda container and then things work as normal -- especially creating conda envs from within the Dockerfile with the name of my choosing.

0 Answers
Related