목차

Production Docker Image for Apache Airflow

Intro

What this talk is NOT about?

Who is the talk for?

What is a container?

Container != Docker

Context: What is Container file

FROM ubuntu:18.04
COPY . /app
RUN make /app && make install
WORKDIR /bin/project
ENTRYPOINT ["/bin/project"]
CMD ["--help"]

Why containers are important?

Internals

Features of the production image file

Extending Airflow image - use released image

docker build . -t yourcompany/airflow:1.10.11-BUILD_Id

FROM apache/airflow:1.10.11

# change to root user temporarily
USER root

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    emacs \
    && apt-get autoremove -yqq --purge \
    && apt-get clean \
    && rm -rf '/var/lib/apt/lists/*'
    
# Change back to the airflow user
USER airflow

# Add extra dependencies
RUN pip install --user numpy

# Embed DAGs (Optionally) - DAGs can be baked in but also
# they can be git-synced or mounted from shared volume
COPY --chown=airflow:root dags-folder $(AIRFLOW_HOME)/dags/

Extending image - Pros & Cons

Pros

Cons

Customizing Airflow image - default docker build

git clone [email protected]:apache/airflow.git

cd airflow

git checkout v1-10-stable

docker build .

Customizing Airflow image - use build args

7nxqhmy.jpg

It's a Breeze to build images

See BREEZE.rst in the Airflow repo

f7dnoey.jpg

How to deploy the images?


관련 문서