我试着用conda建立一个码头形象,这就是我到目前为止所得到的,
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在构建此映像时,会出现有关包冲突的错误。我该怎么解决这个问题?
有许多冲突。这里只是冲突的例子:
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']发布于 2022-09-01 21:02:58
使用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/*发布于 2022-11-08 23:50:49
如果您可以只使用miniconda,并且想使用env.yml管理环境,则可以导出您的本地工作环境:
FROM conda/miniconda3
ADD environment.yml /tmp/environment.yml
COPY ./app ./app
RUN conda update -n base -c defaults conda
RUN conda env create -f /tmp/environment.yml
# Pull the environment name out of the environment.yml
RUN echo "source activate $(head -1 /tmp/environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /opt/conda/envs/$(head -1 /tmp/environment.yml | cut -d' ' -f2)/bin:$PATH
CMD [ "python", "./app/main.py" ]否则:
FROM conda/miniconda3
RUN conda create -n env python=3.6
RUN echo "source activate env" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATHhttps://stackoverflow.com/questions/66481634
复制相似问题