docker - 构建 Docker 镜像
问题描述
我正在尝试使用 Dockerfile 构建自己的 docker 映像。但是,Docker 映像有问题。这是我的码头文件。第一次,它说成功构建了图像;但是,某些软件包无法正常工作(例如权限被拒绝和命令未找到等错误),因此我决定删除所有图像和容器以重建此图像。它一直说使用缓存而不是重新安装所有软件包。当我使用这个 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 config --add channels defaults
RUN conda config --add channels bioconda
RUN conda config --add channels conda-forge
RUN conda install -c bioconda bowtie2 fastqc samtools ucsc-bedsort ucsc-bedgraphtobigwig bedtools deeptools homer seacr
解决方案
就像评论中的其他人所说的那样,您的 Dockerfile 可以正确构建,并且应该使用docker run
. 我有一些使用Nextflow构建和运行 Docker 容器的经验,所以我想我会分享我构建一个包含运行工作流所需的所有包的容器的经验。
首先,考虑将所需的包移动到environment.yml文件中。这将有助于将项目的所有依赖项保存在一个地方:
name: my-awesome-project
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- bowtie2
- fastqc
- samtools
- ucsc-bedsort
- ucsc-bedgraphtobigwig
- bedtools
- deeptools
- homer
- seacr
其次,考虑改为从continuumio/miniconda3 构建您的 Dockerfile:
FROM continuumio/miniconda3:4.9.2
RUN apt-get update \
&& apt-get install -y procps \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
COPY environment.yml /
RUN conda env create -f /environment.yml \
&& conda clean -a
ENV PATH /opt/conda/envs/my-awesome-project/bin:$PATH
COPY install_packages.R /
COPY bed_convert.R /
COPY cut_tag_fingerprint_cmd.R /
RUN Rscript install_packages.R
CMD ["Rscript", "bed_convert.R"]
CMD ["Rscript", "cut_tag_fingerprint_cmd.R"]
最后,将 Conda 和 Docker 的配置文件添加到nextflow.config文件中。也许像下面这样就足够了:
process.container = 'my-awesome-project:v1.0'
profiles {
conda { process.conda = "${baseDir}/environment.yml" }
docker { docker.enabled = true }
singularity { singularity.enabled = true }
}
推荐阅读
- python - 为 arm64 交叉编译 python 包
- vba - 在“动作”菜单中自动更改 PowerPoint 形状的超链接
- javascript - Vetur 找不到 package.json
- c# - 使用 control-m 使用控制台应用程序运行 vba 宏时,无法将 Excel 工作簿保存到远程位置
- python - 表格的堆积条形图
- html - div里面的内容没有完全出现?
- ibm-cloud - IBM Cloud Code Engine:当应用程序不活动时如何检查日志?
- python - Matplotlib:在一行上显示多个标签
- php - 如何在 smarty 中使用 .env 文件?
- python - urllib.request.Request - 如何发送 csv 文件作为请求中的输入