Content Introduction Prerequisites Configuring Domain with Route53 Introduction AWS S3 is used to host the static website. We can use...Read More
In this tutorial, we recommended methods and best practices for building efficient images.
The Docker builds images automatically by following or reading the instructions from a Dockerfile (here, Dockerfile is a text file that store or contains all the commands, in order, that are needed/required to build a given image).
Dockerfile stick to a specific format and set of instructions. A Docker image consists of read-only layers each of which reflects a Dockerfile instruction. The layers are stacked and each layer is a delta of the changes from the previous layer.
COPY . /app
RUN make /app
CMD python /app/app.py
Each and every instruction creates a layer:
When the image runs and generates a new container, it adds a new writable layer (known as the “container layer”) on top of the underlying layers. All the changes made to the running container, such as modifying existing files, deleting files, and writing new files are written to this thin writable container layer.
# Set one or more individual labels
LABEL vendor1="ACME Incorporated"
LABEL vendor2=ZENITH\ Incorporated
RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt
COPY . /tmp/
ADD https://example.com/big.tar.xz /usr/src/things/
RUN tar -xJf /usr/src/things/big.tar.xz -C /usr/src/things
RUN make -C /usr/src/things all
Below are some Official Images which have exemplary Dockerfiles: