0

Hi there I'm new to Docker and Dockerfiles in general,

However, I will need to create one in order to load an application on a server using WDL. With that said, there are few important aspects of this Dockerfile:

  1. requires to create a Conda environment
  2. in there I have to install Snakemake (through Mamba)
  3. finally, I will need to git clone a repository and follow the steps to generate an executable for the application, later invoked by Snakemake

Luckily, it seems most of the pieces are already on dockerhub; correct if I'm wrong based on the script (see below)

# getting ubuntu base image & anaconda3 loaded
  2 FROM ubuntu:latest
  3 FROM continuumio/anaconda3:2021.05
  4 FROM condaforge/mambaforge:latest
  5 FROM snakemake/snakemake:stable
  6 
  7 FROM node:alpine
  8 RUN apk add --no-cache git
  9 RUN apk add --no-cache openssh
 10 
 11 MAINTAINER Name <email>
 12 
 13 WORKDIR /home/xxx/Desktop/Pangenie
 14 
 15 ## ACTUAL PanGenIe INSTALLATION
 16 RUN git clone https://github.com/eblerjana/pangenie.git /home/xxx/Desktop/Pangenie
 17 # create the environment
 18 RUN conda env create -f environment.yml
 19 # build the executable
 20 RUN conda activate pangenie
 21 RUN mkdir build; cd build; cmake .. ; make

First, I think that loading also Mamba and Snakemake would allow me to simply launch the application, as the tools are already set-up by the Dockerfile. Then, I ideally would like to build from the repository the executable, still I get an error at line 18 when I try to create a Conda environment, this is what I get:

[+] Building 1.7s (10/10) FINISHED
[internal] load build definition from Dockerfile                      
0.1s  => => transferring dockerfile: 708B                                                                                                                                                                                                        0.1s  => [internal] load .dockerignore                                                                                                                                                                                                           0.1s  => => transferring context: 2B                                                                                                                                                                                                             0.1s  => [internal] load metadata for docker.io/library/node:alpine                                                                                                                                                                              1.4s  => [auth] library/node:pull token for registry-1.docker.io                                                                                                                                                                                 0.0s  => [stage-4 1/6] FROM docker.io/library/node:alpine@sha256:1a04e2ec39cc0c3a9657c1d6f8291ea2f5ccadf6ef4521dec946e522833e87ea
0.0s  => CACHED [stage-4 2/6] RUN apk add --no-cache git                                                                                                                                                                                         0.0s  => CACHED [stage-4 3/6] RUN apk add --no-cache openssh                                                                                                                                                                                     0.0s  => CACHED [stage-4 4/6] WORKDIR /home/mat/Desktop/Pangenie                                                                                                                                                                                 0.0s  => CACHED [stage-4 5/6] RUN git clone https://github.com/eblerjana/pangenie.git /home/mat/Desktop/Pangenie  
0.0s  => ERROR [stage-4 6/6] RUN conda env create -f environment.yml                                                                                                                                                                             0.1s
[stage-4 6/6] RUN conda env create -f environment.yml:
#10 0.125 /bin/sh: conda: not found   executor failed running [/bin/sh -c conda env create -f environment.yml]: exit code: 127

Now, I'm not really experienced as I said, and I spent some time looking for a solution and tried different things, but nothing worked out... if anyone has an idea or even suggesions on how to fix this Dockerfile, please let me know.

Thanks in advance!

torek
  • 448,244
  • 59
  • 642
  • 775
Matteo
  • 17
  • 4
  • 1
    Welcome to Stack Overflow. From my understanding, what you are doing with multiple `FROM` statements one after the other can't be doing what you think it's doing, as only the last one has any effect. Multiple `FROM` statements are used to perform multi-stage builds, not to bring resources from multiple images into a single build. So in your case, the only `FROM` that is doing anything for you is the last one, `FROM node:alpine`. Since that image does not have `conda` installed into it, you are getting the error you are seeing. – CryptoFool Nov 08 '22 at 00:21
  • 1
    Does this answer your question? [Multiple FROMs - what it means](https://stackoverflow.com/questions/33322103/multiple-froms-what-it-means) – CryptoFool Nov 08 '22 at 00:28
  • Thank you so much @CryptoFool I had a look at the post, and thanks for clarifying the concept as well. I will try and work with the simple `FROM continuumio/anaconda3:2021.05` to get my environment going and follow up from there! – Matteo Nov 08 '22 at 04:06

0 Answers0