Text document that has instructions on how to create a docker images.

resource allocation, such as GPU access, CPU limits, or memory constraints, cannot be done within the Dockerfile itself. Use Docker Compose files for that.

Base Image: You can use base images, on top of which your own image is then created. Oftentimes those are images from Linux distributions.

Layers: each layer denotes a collection of filesystem modifications. Each instruction adds a layer on top of the previous one while building a docker image.

Base buildup of a Dockerfile:

FROM <BaseImage>

WORKDIR /app
COPY . /app

# set better python behaviour inside of containers
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies
RUN pip install --upgrade pip

RUN <command name>
CMD <["executable","param1","param2",...]>

ENV <ENV_VAR_NAME> <env_var_value>

EXPOSE <portnumber>