构建Docker映像

编程入门 行业动态 更新时间:2024-10-11 01:16:04
本文介绍了构建Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用Dockerfile构建自己的Docker映像.但是,Docker映像出了点问题.这是我的dockerfile.第一次,它说成功建立了映像;但是,某些软件包无法正常工作(诸如权限被拒绝和找不到命令之类的错误),所以我决定删除所有映像和容器以重建该映像.它一直说使用缓存而不是重新安装所有软件包.当我使用此docker时,它在一开始就会失败.

I'm trying to build my own docker image using Dockerfile. However, there is something wrong with the Docker image. Here is my dockerfile. At first time, it said successfully built the image; however, some of the package is not working(errors like permission denied and command not found), so I decided to remove all the image and container to rebuild this image. It kept saying using cache instead of reinstall all the packages. When I use this docker, it fails at the very beginning.

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 \ repo.anaconda/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容器的经验,所以我想与我分享构建一个Docker容器的经验.容器,其中包含运行您的工作流程所需的所有软件包.

Like others in the comments have stated, your Dockerfile builds correctly and should work as expected using docker run. I have some experience building and running Docker containers using Nextflow, so I thought I'd share my experience building a container that contains all the packages required to run your workflow.

首先,考虑将所需的软件包移至 environment.yml 文件.这将有助于将您所有项目的依赖项放在一个地方:

Firstly, consider moving your required packages into an environment.yml file. This will help keep all your project's dependencies in one place:

name: my-awesome-project channels: - bioconda - conda-forge - defaults dependencies: - bowtie2 - fastqc - samtools - ucsc-bedsort - ucsc-bedgraphtobigwig - bedtools - deeptools - homer - seacr

第二,请考虑改为从 continuumio/miniconda3 构建您的Dockerfile:

Secondly, consider instead building your Dockerfile from continuumio/miniconda3:

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中文件.也许可以满足以下要求:

Finally, add profiles for Conda and Docker to your nextflow.config file. Perhaps something like the following will suffice:

process.container = 'my-awesome-project:v1.0' profiles { conda { process.conda = "${baseDir}/environment.yml" } docker { docker.enabled = true } singularity { singularity.enabled = true } }

更多推荐

构建Docker映像

本文发布于:2023-10-27 04:25:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532308.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:映像   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!