<p>I select the Miniconda installer directly from the official repository:</p>
<pre><code>FROM ubuntu:20.04
ENV LANG C.UTF-8
SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;]
RUN apt update -qq &amp;&amp; apt -qq -y install curl ca-certificates --no-install-recommends
RUN ( cd /tmp/; curl -LO &quot;http://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh&quot;)
RUN bash /tmp/Miniconda3-py38_4.10.3-Linux-x86_64.sh -b -p /opt/conda
ENV PATH=/opt/conda/bin:<span class="math-container">${PATH}
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
RUN echo "source activate snakemake" &gt; ~/.bashrc
ENV PATH /opt/conda/envs/snakemake/bin:$</span>{PATH}
</code></pre>

CC BY-SA 4.0
2022-03-18T13:34:18.090Z
I agree with this AWS was being used as the source of miniconda rather than a direct download from conda. The alternative is simply to download the official conda docker
M__
CC BY-SA 4.0
2021-10-19T11:46:41.673Z
2021-10-19T11:46:41.673Z
zorbax
<p>Try</p>
<pre><code>FROM ubuntu:latest
MAINTAINER Conda Development Team &lt;conda@continuum.io&gt;

RUN apt-get -qq update &amp;&amp; apt-get -qq -y install curl bzip2 \
    &amp;&amp; curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
    &amp;&amp; bash /tmp/miniconda.sh -bfp /usr/local \
    &amp;&amp; rm -rf /tmp/miniconda.sh \
    &amp;&amp; conda install -y python=3 \
    &amp;&amp; conda update conda \
    &amp;&amp; apt-get -qq -y remove curl bzip2 \
    &amp;&amp; apt-get -qq -y autoremove \
    &amp;&amp; apt-get autoclean \
    &amp;&amp; rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
    &amp;&amp; conda clean --all --yes
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
ENV PATH /opt/conda/envs/snakemake/bin:${PATH}
</code></pre>
<p>The &amp;&amp; approach is better as it will minimise the container size (which is going to be big in any case). Then look at an alpine version once its working.</p>
<p>To be honest, I'm not sure about not activating conda base and personally I'd look to correct that.</p>
<p>Alternatively ...</p>
<pre><code>docker pull continuumio/miniconda3
docker run -i -t continuumio/miniconda3 /bin/bash
</code></pre>
<p>Just for a chuckle, a cool approach is</p>
<pre><code>docker pull frolvlad/alpine-miniconda3
</code></pre>
<p>This is super small.</p>
<p>The docker file being</p>
<pre><code>FROM frolvlad/alpine-glibc:alpine-3.14

ARG CONDA_VERSION=&quot;4.7.12.1&quot;
ARG CONDA_MD5=&quot;81c773ff87af5cfac79ab862942ab6b3&quot;
ARG CONDA_DIR=&quot;/opt/conda&quot;

ENV PATH=&quot;<span class="math-container">$CONDA_DIR/bin:$</span>PATH&quot;
ENV PYTHONDONTWRITEBYTECODE=1

# Install conda
RUN echo &quot;**** install dev packages ****&quot; &amp;&amp; \
    apk add --no-cache --virtual .build-dependencies bash ca-certificates wget &amp;&amp; \
    \
    echo &quot;**** get Miniconda ****&quot; &amp;&amp; \
    mkdir -p &quot;<span class="math-container">$CONDA_DIR" &amp;&amp; \
    wget "http://repo.continuum.io/miniconda/Miniconda3-$</span>{CONDA_VERSION}-Linux-x86_64.sh&quot; -O miniconda.sh &amp;&amp; \
    echo &quot;<span class="math-container">$CONDA_MD5  miniconda.sh" | md5sum -c &amp;&amp; \
    \
    echo "**** install Miniconda ****" &amp;&amp; \
    bash miniconda.sh -f -b -p "$</span>CONDA_DIR&quot; &amp;&amp; \
    echo &quot;export PATH=<span class="math-container">$CONDA_DIR/bin:\\\$PATH" &gt; /etc/profile.d/conda.sh &amp;&amp; \
    \
    echo "**** setup Miniconda ****" &amp;&amp; \
    conda update --all --yes &amp;&amp; \
    conda config --set auto_update_conda False &amp;&amp; \
    \
    echo "**** cleanup ****" &amp;&amp; \
    apk del --purge .build-dependencies &amp;&amp; \
    rm -f miniconda.sh &amp;&amp; \
    conda clean --all --force-pkgs-dirs --yes &amp;&amp; \
    find "$</span>CONDA_DIR&quot; -follow -type f \( -iname '*.a' -o -iname '*.pyc' -o -iname '*.js.map' \) -delete &amp;&amp; \
    \
    echo &quot;**** finalize ****&quot; &amp;&amp; \
    mkdir -p &quot;<span class="math-container">$CONDA_DIR/locks" &amp;&amp; \
    chmod 777 "$</span>CONDA_DIR/locks&quot;
</code></pre>
<p>Whoever frolvlad is they certainly know their stuff, its a highly optimised image. This will absolutely nail a light-weight conda file. How well conda will work with Snakemake  ... it is  well worth trying because the alpine image is 5meg (Ubuntu is 100+ Megs) and I forget how big conda is. I need to do this more for sure, because almost certainly what they have done is streamlined conda to the absolute essentials. Get that working your looping the loop.</p>
<p>Why is this potentially super cool? The problem with alpine is its so minimalist getting anything to work is not easy. <code>frolvlad</code> in theory solved this bit via conda, because conda is completely self-contained once its running. Thus its doesn't need any system stuff at all, hence alpine and conda in THEORY would be a fantastic solution.</p>
<p>My honest opinion is you are sort of trying to reinvent the wheel  (which sometimes that's a good thing). However, I think you'd find the other stuff just works because someone has sat down with yaml and tested everything endlessly.</p>
<p>The problem with your file is you've got to clean it without additional layers being dumped onto it and that's why loads of &amp;&amp; because that enables a clean without a layer collapsing onto it blocking the clean. The docker file you create has loads of unnecessary stuff, which you can't delete. I guess your priority is to get it working.</p>

CC BY-SA 4.0
2022-03-18T13:44:41.893Z
2022-03-18T14:53:45.460Z
2022-03-18T14:53:45.460Z
M__
<p>Following the <a href="https://snakemake.readthedocs.io/en/stable/getting_started/installation.html" rel="nofollow noreferrer">docs</a> just won't work for me.</p>
<pre><code>conda install -n base -c conda-forge mamba
conda activate base
mamba create -c conda-forge -c bioconda -n snakemake snakemake
</code></pre>
<p>This is the Dockerfile I use:</p>
<pre><code>FROM ubuntu:20.04
ENV PATH /opt/conda/bin:${PATH}
ENV LANG C.UTF-8
ENV SHELL /bin/bash
COPY aws/docker/Miniconda3-py38_4.10.3-Linux-x86_64.sh /tmp/
RUN bash /tmp/Miniconda3-py38_4.10.3-Linux-x86_64.sh -b -p /opt/conda
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
</code></pre>
<p>The error is:</p>
<pre><code>WARNING Extracted package cache '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu' has invalid size
WARNING Extracted package cache '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu' has invalid SHA-256 checksum
WARNING Package tarball '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu.tar.bz2' is invalid
  Package                              Version  Build                Channel                     Size
───────────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────────────────────────────────

  ...Package list omitted

  Ignored:
───────────────────────────────────────────────────────────────────────────────────────────────────────

  = snakemake                            6.9.1  hdfd78af_0           bioconda/noarch          Ignored
  = snakemake-minimal                    6.9.1  pyhdfd78af_0         bioconda/noarch          Ignored

  Summary:

  Install: 215 packages
  Ignored: 2 packages

  Total download: 256 MB

───────────────────────────────────────────────────────────────────────────────────────────────────────

ERROR   File not valid: SHA256 sum doesn't match expectation &quot;/opt/conda/pkgs/gettext-0.19.8.1-h73d1719_1008.tar.bz2&quot;
        Expected: 1bb53c99b4943d210c881aad9158fb0235b348498bad1a7076d1f2bef6671922
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation &quot;/opt/conda/pkgs/gtk2-2.24.33-h539f30e_1.tar.bz2&quot;
        Expected: 2a0aef09a947e3768a426b0ea414ddd1e015c9804a46de619a5e67a689ea1dec
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation &quot;/opt/conda/pkgs/botocore-1.21.64-pyhd8ed1ab_0.tar.bz2&quot;
        Expected: ee5501c74eefd0396f141593933ef2cc3419ad21624ed140bbc1e04944af6e31
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation &quot;/opt/conda/pkgs/libopenblas-0.3.18-pthreads_h8fe5266_0.tar.bz2&quot;
        Expected: 6d67f0f7bda1503af83659ca45d8c8ba34d94091fa4cd5b1ecd85332c14db3cc
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation &quot;/opt/conda/pkgs/scipy-1.7.1-py39hee8e79c_0.tar.bz2&quot;
        Expected: 536500b79a5ccc91f6059fcaa6d7e959bddb37a0ed7a930797375c1ed51a6af1
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855


# &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; ERROR REPORT &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;

    Traceback (most recent call last):
      File &quot;/opt/conda/lib/python3.8/site-packages/conda/exceptions.py&quot;, line 1079, in __call__
        return func(*args, **kwargs)
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 926, in exception_converter
        raise e
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 920, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 878, in _wrapped_main
        result = do_call(args, p)
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 757, in do_call
        exit_code = create(args, parser)
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 660, in create
        return install(args, parser, &quot;create&quot;)
      File &quot;/opt/conda/lib/python3.8/site-packages/mamba/mamba.py&quot;, line 609, in install
        downloaded = transaction.prompt(repos)
    RuntimeError: Found incorrect download: libopenblas. Aborting

`$ /opt/conda/bin/mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps`

  environment variables:
                 CIO_TEST=&lt;not set&gt;
               CONDA_ROOT=/opt/conda
           CURL_CA_BUNDLE=&lt;not set&gt;
                     PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
                          :/bin
       REQUESTS_CA_BUNDLE=&lt;not set&gt;
            SSL_CERT_FILE=&lt;not set&gt;

     active environment : None
       user config file : /root/.condarc
 populated config files :
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.8.10.final.0
       virtual packages : __linux=5.10.16.3=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/conda  (writable)
      conda av data dir : /opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/bioconda/linux-64
                          https://conda.anaconda.org/bioconda/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2 ubuntu/20.04.3 glibc/2.31
                UID:GID : 0:0
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
</code></pre>

CC BY-SA 4.0
2021-10-19T07:20:25.877Z
Curious that the checksums are wrong. Is there something wonky with the network that it might be changing the packages? What happens if you manually download those packages and look at their checksums?
Devon Ryan
CC BY-SA 4.0
2021-10-19T08:27:26.150Z
Yes I have found similar comment on Github page I think. Somehow it is hard for me to blame the network. I thought that I am missing something. When I manually download the file. SHA256 matches the expected one.
titus
CC BY-SA 4.0
2021-10-19T08:45:42.593Z
What happens if you run mamba outside of a container?
Devon Ryan
CC BY-SA 4.0
2021-10-19T09:31:14.843Z
Yes, on fresh Ubuntu 20.04 EC2 machine it installs just fine. On Docker packages are randomly failing SHA256 checksums. Interesting fact is that I am on Windows WSL (company policy) and that thing gave just trouble.
titus
CC BY-SA 4.0
2021-10-19T19:24:42.747Z
Weird, I wonder if something is messed up in the docker networking interface. I never tried to set docker up under wsl, I just start a new wsl OS if needed (I have similar company restrictions).
Devon Ryan
CC BY-SA 4.0
2021-10-19T19:52:32.000Z
I've ran a build using our Gitlab runner. Everything works just fine.
titus
<snakemake><docker>
Installing snakemake following official docs just won't work. Help needed
# Installing snakemake following official docs just won't work. Help needed

(Asked by: username_0 on 2021-10-19)

Following the docs just won't work for me.
conda install -n base -c conda-forge mamba
conda activate base
mamba create -c conda-forge -c bioconda -n snakemake snakemake

This is the Dockerfile I use:
FROM ubuntu:20.04
ENV PATH /opt/conda/bin:${PATH}
ENV LANG C.UTF-8
ENV SHELL /bin/bash
COPY aws/docker/Miniconda3-py38_4.10.3-Linux-x86_64.sh /tmp/
RUN bash /tmp/Miniconda3-py38_4.10.3-Linux-x86_64.sh -b -p /opt/conda
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps

The error is:
WARNING Extracted package cache '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu' has invalid size
WARNING Extracted package cache '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu' has invalid SHA-256 checksum
WARNING Package tarball '/opt/conda/pkgs/_openmp_mutex-4.5-1_gnu.tar.bz2' is invalid
  Package                              Version  Build                Channel                     Size
───────────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────────────────────────────────

  ...Package list omitted

  Ignored:
───────────────────────────────────────────────────────────────────────────────────────────────────────

  = snakemake                            6.9.1  hdfd78af_0           bioconda/noarch          Ignored
  = snakemake-minimal                    6.9.1  pyhdfd78af_0         bioconda/noarch          Ignored

  Summary:

  Install: 215 packages
  Ignored: 2 packages

  Total download: 256 MB

───────────────────────────────────────────────────────────────────────────────────────────────────────

ERROR   File not valid: SHA256 sum doesn't match expectation "/opt/conda/pkgs/gettext-0.19.8.1-h73d1719_1008.tar.bz2"
        Expected: 1bb53c99b4943d210c881aad9158fb0235b348498bad1a7076d1f2bef6671922
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation "/opt/conda/pkgs/gtk2-2.24.33-h539f30e_1.tar.bz2"
        Expected: 2a0aef09a947e3768a426b0ea414ddd1e015c9804a46de619a5e67a689ea1dec
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation "/opt/conda/pkgs/botocore-1.21.64-pyhd8ed1ab_0.tar.bz2"
        Expected: ee5501c74eefd0396f141593933ef2cc3419ad21624ed140bbc1e04944af6e31
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation "/opt/conda/pkgs/libopenblas-0.3.18-pthreads_h8fe5266_0.tar.bz2"
        Expected: 6d67f0f7bda1503af83659ca45d8c8ba34d94091fa4cd5b1ecd85332c14db3cc
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

ERROR   File not valid: SHA256 sum doesn't match expectation "/opt/conda/pkgs/scipy-1.7.1-py39hee8e79c_0.tar.bz2"
        Expected: 536500b79a5ccc91f6059fcaa6d7e959bddb37a0ed7a930797375c1ed51a6af1
        Actual: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855


# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/opt/conda/lib/python3.8/site-packages/conda/exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 926, in exception_converter
        raise e
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 920, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 878, in _wrapped_main
        result = do_call(args, p)
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 757, in do_call
        exit_code = create(args, parser)
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 660, in create
        return install(args, parser, "create")
      File "/opt/conda/lib/python3.8/site-packages/mamba/mamba.py", line 609, in install
        downloaded = transaction.prompt(repos)
    RuntimeError: Found incorrect download: libopenblas. Aborting

`$ /opt/conda/bin/mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps`

  environment variables:
                 CIO_TEST=
               CONDA_ROOT=/opt/conda
           CURL_CA_BUNDLE=
                     PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
                          :/bin
       REQUESTS_CA_BUNDLE=
            SSL_CERT_FILE=

     active environment : None
       user config file : /root/.condarc
 populated config files :
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.8.10.final.0
       virtual packages : __linux=5.10.16.3=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/conda  (writable)
      conda av data dir : /opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/bioconda/linux-64
                          https://conda.anaconda.org/bioconda/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.8.10 Linux/5.10.16.3-microsoft-standard-WSL2 ubuntu/20.04.3 glibc/2.31
                UID:GID : 0:0
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

**Tags:** snakemake, docker
> **Comments:**
> **username_1**: Curious that the checksums are wrong. Is there something wonky with the network that it might be changing the packages? What happens if you manually download those packages and look at their checksums?  
> **username_0**: Yes I have found similar comment on Github page I think. Somehow it is hard for me to blame the network. I thought that I am missing something. When I manually download the file. SHA256 matches the expected one.  
> **username_1**: What happens if you run mamba outside of a container?  
> **username_0**: Yes, on fresh Ubuntu 20.04 EC2 machine it installs just fine. On Docker packages are randomly failing SHA256 checksums. Interesting fact is that I am on Windows WSL (company policy) and that thing gave just trouble.  
> **username_1**: Weird, I wonder if something is messed up in the docker networking interface. I never tried to set docker up under wsl, I just start a new wsl OS if needed (I have similar company restrictions).  
> **username_0**: I've ran a build using our Gitlab runner. Everything works just fine.  

---

## 2 answers

### Answer by username_2 on 2021-10-19. Score: 1

I select the Miniconda installer directly from the official repository:
FROM ubuntu:20.04
ENV LANG C.UTF-8
SHELL ["/bin/bash", "-c"]
RUN apt update -qq && apt -qq -y install curl ca-certificates --no-install-recommends
RUN ( cd /tmp/; curl -LO "http://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh")
RUN bash /tmp/Miniconda3-py38_4.10.3-Linux-x86_64.sh -b -p /opt/conda
ENV PATH=/opt/conda/bin:${PATH}
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
RUN echo "source activate snakemake" > ~/.bashrc
ENV PATH /opt/conda/envs/snakemake/bin:${PATH}

> **Comments:**
> **username_3**: I agree with this AWS was being used as the source of miniconda rather than a direct download from conda. The alternative is simply to download the official conda docker  

---

### Answer by username_3 on 2022-03-18. Score: 0

Try
FROM ubuntu:latest
MAINTAINER Conda Development Team 

RUN apt-get -qq update && apt-get -qq -y install curl bzip2 \
    && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
    && bash /tmp/miniconda.sh -bfp /usr/local \
    && rm -rf /tmp/miniconda.sh \
    && conda install -y python=3 \
    && conda update conda \
    && apt-get -qq -y remove curl bzip2 \
    && apt-get -qq -y autoremove \
    && apt-get autoclean \
    && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
    && conda clean --all --yes
RUN conda install -y -c conda-forge mamba
RUN mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
ENV PATH /opt/conda/envs/snakemake/bin:${PATH}

The && approach is better as it will minimise the container size (which is going to be big in any case). Then look at an alpine version once its working.
To be honest, I'm not sure about not activating conda base and personally I'd look to correct that.
Alternatively ...
docker pull continuumio/miniconda3
docker run -i -t continuumio/miniconda3 /bin/bash

Just for a chuckle, a cool approach is
docker pull frolvlad/alpine-miniconda3

This is super small.
The docker file being
FROM frolvlad/alpine-glibc:alpine-3.14

ARG CONDA_VERSION="4.7.12.1"
ARG CONDA_MD5="81c773ff87af5cfac79ab862942ab6b3"
ARG CONDA_DIR="/opt/conda"

ENV PATH="$CONDA_DIR/bin:$PATH"
ENV PYTHONDONTWRITEBYTECODE=1

# Install conda
RUN echo "**** install dev packages ****" && \
    apk add --no-cache --virtual .build-dependencies bash ca-certificates wget && \
    \
    echo "**** get Miniconda ****" && \
    mkdir -p "$CONDA_DIR" && \
    wget "http://repo.continuum.io/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh" -O miniconda.sh && \
    echo "$CONDA_MD5  miniconda.sh" | md5sum -c && \
    \
    echo "**** install Miniconda ****" && \
    bash miniconda.sh -f -b -p "$CONDA_DIR" && \
    echo "export PATH=$CONDA_DIR/bin:\\\$PATH" > /etc/profile.d/conda.sh && \
    \
    echo "**** setup Miniconda ****" && \
    conda update --all --yes && \
    conda config --set auto_update_conda False && \
    \
    echo "**** cleanup ****" && \
    apk del --purge .build-dependencies && \
    rm -f miniconda.sh && \
    conda clean --all --force-pkgs-dirs --yes && \
    find "$CONDA_DIR" -follow -type f \( -iname '*.a' -o -iname '*.pyc' -o -iname '*.js.map' \) -delete && \
    \
    echo "**** finalize ****" && \
    mkdir -p "$CONDA_DIR/locks" && \
    chmod 777 "$CONDA_DIR/locks"

Whoever frolvlad is they certainly know their stuff, its a highly optimised image. This will absolutely nail a light-weight conda file. How well conda will work with Snakemake  ... it is  well worth trying because the alpine image is 5meg (Ubuntu is 100+ Megs) and I forget how big conda is. I need to do this more for sure, because almost certainly what they have done is streamlined conda to the absolute essentials. Get that working your looping the loop.
Why is this potentially super cool? The problem with alpine is its so minimalist getting anything to work is not easy. frolvlad in theory solved this bit via conda, because conda is completely self-contained once its running. Thus its doesn't need any system stuff at all, hence alpine and conda in THEORY would be a fantastic solution.
My honest opinion is you are sort of trying to reinvent the wheel  (which sometimes that's a good thing). However, I think you'd find the other stuff just works because someone has sat down with yaml and tested everything endlessly.
The problem with your file is you've got to clean it without additional layers being dumped onto it and that's why loads of && because that enables a clean without a layer collapsing onto it blocking the clean. The docker file you create has loads of unnecessary stuff, which you can't delete. I guess your priority is to get it working.


---

