docker:关于docker映像格式和图层的建议

时间:2018-11-23 03:47:06

标签: docker dockerfile

我正在尝试构建docker映像,以使其较小,但是我不确定这是否是使每一层保持较小状态的好模式。是否开放任何建议?

我好奇的要点是与每一层的“更新”和“ rm”有关。我应该这样做还是有更好的方法?

# our base image
FROM ubuntu

ENV DEBIAN_FRONTEND "noninteractive apt-get autoremove"
RUN apt-get update && apt-get install -y locales \
    && locale-gen en_AU.UTF-8 \
    && dpkg-reconfigure locales \
    && rm -rf /var/lib/apt/lists/*
ENV LANG en_AU.UTF-8
ENV LANGUAGE en_AU.UTF-8
ENV LC_ALL en_AU.UTF-8
ENV LC_CTYPE=en_AU.UTF-8
ENV TZ="Australia/Adelaide"

# networking and routing tools
RUN apt-get update && apt install -y \
    net-tools telnet dnsutils inetutils-traceroute \
    curl jq \
    postgresql redis-tools mongodb-clients \
    && rm -rf /var/lib/apt/lists/*

# node libs for test scripts
RUN apt-get update && apt-get install -y \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

0 个答案:

没有答案