DockerFile - Run command

Card Puncher Data Processing

About

The RUN instruction will execute any commands in a new layer on top of the current image and commit the results.

Example

How to run a script without copying it

With the –mount option 1), you don't need to copy executing script and dependencies into the image layers.

Example:

RUN --mount=target=/build /build/setup.sh

where:

  • –mount=target=/build is mounting the Docker context into the /build directory of the build image.
  • /build/setup.sh is the executing command

Tool installation

the package are sorted in alphabetical order

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

Pipeline error handling

Pipe: set -o pipefail will fail the pipeline if one stage fails

RUN set -o pipefail && wget -O - https://some.site | wc -l > /number

Documentation / Reference





Discover More
Card Puncher Data Processing
Docker - History

The history command permits you to see the commit history of your image The RUN command in a dockerfile creates automatically a commit
Card Puncher Data Processing
DockerFile - Instruction

Basis Image: Tool installation (note: the package are sorted in alphabetical order) More ... Defines argument that can be passed by the build command line ...
Card Puncher Data Processing
What is the Docker Build Context?

The Docker Build Context or Build Context or Context is a list of files sent to the daemon when the build command is executed All files from: a directory if they are not in ignore file a archive...



Share this page:
Follow us:
Task Runner