如何在多阶段Docker File中将所有工件从源复制到目标

时间:2020-07-31 17:52:06

标签: linux docker ubuntu dockerfile docker-registry

我分为两个阶段:

第1阶段

    FROM mongo:latest AS mongodb
    ENV MONGO_INITDB_ROOT_USERNAME root
    ENV MONGO_INITDB_ROOT_PASSWORD root
    ENV MONGO_INITDB_DATABASE admin
    ADD mongo-init.js /docker-entrypoint-initdb.d/

阶段#02

FROM ubuntu:18.04 
RUN  apt-get update \
  && apt-get install -y wget \
  && rm -rf /var/lib/apt/lists/*
RUN \
    apt-get update && \
    apt-get install -y supervisor nginx &&\
    rm -rf /var/lib/apt/lists/* 
COPY supervisord.conf /etc/supervisor/
COPY --from=mongodb #How can I copy all artifacts from source to destination

EXPOSE 80
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

这两个阶段都可以完美地分开工作。我如何将所有工件从第一阶段复制到第二阶段?

0 个答案:

没有答案