簡體   English   中英

使用 conda install 構建 Docker 映像

[英]Build Docker image with conda install

我正在嘗試使用 conda 構建 Docker 圖像,這就是我到目前為止所得到的,

FROM ubuntu:18.04
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update

RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*

RUN wget \
    https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Miniconda3-latest-Linux-x86_64.sh -b \
    && rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda --version

RUN conda install -c bioconda bowtie2 fastqc samtools ucsc-bedsort ucsc-bedgraphtobigwig bedtools deeptools homer seacr

構建此映像時,出現有關 package 沖突的錯誤。 我該如何解決這個問題?

有很多沖突。 這里只是沖突的例子:

Examining conflict for bedtools deeptools seacr python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homerExamining conflict for bedtools deeptools seacr python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homerExamining conflict for bedtools deeptools samtools seacr:  15%|█▌        | 2/13 [00:06<00:17,  1.60s/it]        Examining conflict for bedtools deeptools seacr python bowtie2 samtools fastqc ucsc-bedgraphtobigwig ucsc-bedsorExamining conflict for bedtools deeptools seacr bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  38%|Examining conflict for bedtools deeptools seacr bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  46%|Examining conflict for bedtools deeptools samtools:  46%|████▌     | 6/13 [00:15<00:15,  2.15s/it]              Examining conflict for bedtools deeptools python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  54%Examining conflict for bedtools deeptools python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  62%Examining conflict for deeptools python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  62%|██████▏ Examining conflict for deeptools python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort homer:  69%|██████▉ Examining conflict for deeptools samtools:  69%|██████▉   | 9/13 [00:25<00:11,  2.79s/it]                       Examining conflict for deeptools fastqc ucsc-bedsort ucsc-bedgraphtobigwig seacr homer: : 16it [00:59,  4.16s/itExamining conflict for deeptools fastqc ucsc-bedsort ucsc-bedgraphtobigwig seacr homer: : 17it [00:59,  4.76s/itExamining conflict for deeptools fastqc ucsc-bedsort ucsc-bedgraphtobigwig seacr: : 17it [01:02,  4.76s/it]     Examining conflict for deeptools python bowtie2 samtools ucsc-bedgraphtobigwig ucsc-bedsort: : 21it [01:11,  3.4Examining conflict for python ucsc-bedgraphtobigwig ucsc-bedsort: : 22it [01:14,  3.49s/it]                                                                                                                
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package libpng conflicts for:
ucsc-bedsort -> libpng[version='>=1.6.34,<1.7.0a0|>=1.6.35,<1.7.0a0|>=1.6.37,<1.7.0a0']
deeptools -> matplotlib-base[version='>=3.1.0'] -> libpng[version='>=1.6.32,<1.7.0a0|>=1.6.34,<1.7.0a0|>=1.6.35,<1.7.0a0|>=1.6.36,<1.7.0a0|>=1.6.37,<1.7.0a0']
ucsc-bedgraphtobigwig -> libpng[version='>=1.6.34,<1.7.0a0|>=1.6.35,<1.7.0a0|>=1.6.37,<1.7.0a0']
seacr -> r-base -> libpng[version='1.6.*|>=1.6.27,<1.7|>=1.6.32,<1.7.0a0|>=1.6.34,<1.7.0a0|>=1.6.37,<1.7.0a0|>=1.6.35,<1.7.0a0']
homer -> blat -> libpng
fastqc -> fontconfig -> libpng[version='>=1.6.32,<1.7.0a0|>=1.6.34,<1.7.0a0']
deeptools -> libpng
Package libgcc-ng conflicts for:
homer -> perl[version='>=5.26.2,<5.26.3.0a0'] -> libgcc-ng[version='>=7.2.0']
ucsc-bedgraphtobigwig -> libgcc-ng[version='>=4.9|>=7.3.0|>=7.5.0']
ucsc-bedgraphtobigwig -> mysql-connector-c[version='>=6.1.11,<6.1.12.0a0'] -> libgcc-ng[version='>=7.2.0']
python=3.8 -> zlib[version='>=1.2.11,<1.3.0a0'] -> libgcc-ng[version='>=7.2.0']
bowtie2 -> libgcc-ng[version='>=7.3.0|>=7.5.0']
samtools -> zlib[version='>=1.2.11,<1.3.0a0'] -> libgcc-ng[version='>=7.2.0']
ucsc-bedsort -> libgcc-ng[version='>=4.9|>=7.3.0|>=7.5.0']
bedtools -> libgcc-ng[version='>=7.3.0|>=7.5.0']
homer -> libgcc-ng[version='>=7.3.0|>=7.5.0']
bedtools -> zlib[version='>=1.2.11,<1.3.0a0'] -> libgcc-ng[version='>=4.9|>=7.2.0']
samtools -> libgcc-ng[version='>=4.9|>=7.3.0|>=7.5.0']
bowtie2 -> perl -> libgcc-ng[version='>=7.2.0']
ucsc-bedsort -> mysql-connector-c[version='>=6.1.11,<6.1.12.0a0'] -> libgcc-ng[version='>=7.2.0']
seacr -> r-base -> libgcc-ng[version='7.2.0.*|>=7.2.0|>=7.3.0']
deeptools -> deeptoolsintervals[version='>=0.1.8'] -> libgcc-ng[version='>=7.2.0|>=7.5.0']
fastqc -> fontconfig -> libgcc-ng[version='>=7.2.0|>=7.3.0']
deeptools -> libgcc-ng[version='>=4.9|>=7.3.0']
python=3.8 -> libgcc-ng[version='>=7.3.0']

使用 conda 環境聲明依賴項。

my_env.yml:

name: python_3_with_R

channels:
  - conda-forge
  - defaults

dependencies:
- python=3.8
- r-base

Dockerfile 多階段圖案(蛋糕上的櫻桃^^):

##
# This the packaging stage
##
FROM condaforge/mambaforge:4.13.0-1 AS conda-packages

ENV PYTHONDONTWRITEBYTECODE=true

COPY env_zep.yaml /env_zep.yaml

# Setup conda
RUN set -ex && \
    conda config --set always_yes yes --set changeps1 no && \
    conda info -a && \
    conda config --add channels conda-forge && \
    conda install --quiet --freeze-installed -c main conda-pack

# Install python and R packages
RUN mamba env create \
        --quiet \
        --file /env_zep.yaml

# Pack all stuff to get rid of conda
RUN conda pack \
        --exclude *.js.map \
        --exclude *.pyc \
        --exclude *.a \
        --name python_3_with_R \
        --ignore-missing-files \
        --dest-prefix /opt/conda/envs/python_3_with_R \
        --output /python_3_with_R.tar.gz \
        --quiet

##
# The final image
##
FROM ubuntu:20.04

# Append conda in PATH
ENV PATH=/opt/conda/envs/python_3_with_R/bin:/opt/conda/bin:$PATH

# copy pack from previous stage
COPY --from=conda-packages /python_3_with_R.tar.gz /python_3_with_R.tar.gz

# Install pack
RUN mkdir -p /opt/conda/envs/python_3_with_R && \
    tar -xzf /python_3_with_R.tar.gz -C /opt/conda/envs/python_3_with_R/ && \
    rm -rf /tmp/*

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM