DockerFile - Instruction

Card Puncher Data Processing

Instruction

FROM

Basis Image: https://hub.docker.com/_/alpine/

LABEL

# Set one or more individual labels
LABEL com.example.version="0.0.1-beta"
LABEL vendor="ACME Incorporated"
LABEL com.example.release-date="2015-02-12"
LABEL com.example.version.is-production=""

RUN

Tool installation (note: the package are sorted in alphabetical order)

RUN apt-get update && apt-get install -y \
        package-bar \
        package-baz \
        package-foo

More … DockerFile - Run command

ARG

Defines argument that can be passed by the build command line

See Dockerfile - ARG instruction (argument)

ADD /COPY

  • COPY only supports the basic copying of local files into the container,
  • ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious.

COPY is preferred.

COPY them individually, rather than all at once. This ensures that each step’s build cache is only invalidated (forcing the step to be re-run) if the specifically required files change.

COPY ./apache2.conf /etc/apache2/apache2.conf
COPY ./php.ini /usr/local/etc/php/php.ini

Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead. That way you can delete the files you no longer need after they’ve been extracted and you don’t have to add another layer in your image.

RUN mkdir -p /usr/src/things \
    && curl -SL http://example.com/big.tar.xz \
    | tar -xJC /usr/src/things \
    && make -C /usr/src/things all

ENTRYPOINT

See What is the ENTRYPOINT docker instruction?





Discover More
Card Puncher Data Processing
Docker - dockerfile

A Dockerfile specifies instructions on how to create an image. See A Dockerfile describes the software that is “baked” into an image. It isn’t just ingredients though, it can tell the software...
Card Puncher Data Processing
What is the ENTRYPOINT docker instruction?

ENTRYPOINT is a docker instruction that defines the default docker entrypoint It has two different behavior that depends on the assignment format. ENTRYPOINT has the following forms: Command line...



Share this page:
Follow us:
Task Runner