@@ -27,7 +27,9 @@ Quick start scenarios of image extending
27
27
----------------------------------------
28
28
29
29
The most common scenarios where you want to build your own image are adding a new ``apt `` package,
30
- adding a new ``PyPI `` dependency and embedding DAGs into the image.
30
+ adding a new ``PyPI `` dependency (either individually or via requirements.txt) and embedding DAGs
31
+ into the image.
32
+
31
33
Example Dockerfiles for those scenarios are below, and you can read further
32
34
for more complex cases which might involve either extending or customizing the image. You will find
33
35
more information about more complex scenarios below, but if your goal is to quickly extend the Airflow
@@ -46,8 +48,8 @@ switch to the ``root`` user when running the ``apt`` commands, but do not forget
46
48
:end-before: [END Dockerfile]
47
49
48
50
49
- Adding a new ``PyPI `` package
50
- .............................
51
+ Adding new ``PyPI `` packages individually
52
+ .........................................
51
53
52
54
The following example adds ``lxml `` python package from PyPI to the image. When adding packages via
53
55
``pip `` you need to use the ``airflow `` user rather than ``root ``. Attempts to install ``pip `` packages
@@ -58,6 +60,19 @@ as ``root`` will fail with an appropriate error message.
58
60
:start-after: [START Dockerfile]
59
61
:end-before: [END Dockerfile]
60
62
63
+ Adding packages from requirements.txt
64
+ .....................................
65
+
66
+ The following example adds few python packages from ``requirements.txt `` from PyPI to the image.
67
+ Note that similarly when adding individual packages, you need to use the ``airflow `` user rather than
68
+ ``root ``. Attempts to install ``pip `` packages as ``root `` will fail with an appropriate error message.
69
+
70
+ .. exampleinclude :: docker-examples/extending/add-requirement-packages/Dockerfile
71
+ :language: Dockerfile
72
+ :start-after: [START Dockerfile]
73
+ :end-before: [END Dockerfile]
74
+
75
+
61
76
Embedding DAGs
62
77
..............
63
78
@@ -363,6 +378,19 @@ The following example adds ``lxml`` python package from PyPI to the image.
363
378
:start-after: [START Dockerfile]
364
379
:end-before: [END Dockerfile]
365
380
381
+ Example of adding packages from requirements.txt
382
+ ................................................
383
+
384
+ The following example adds few python packages from ``requirements.txt `` from PyPI to the image.
385
+ Note that similarly when adding individual packages, you need to use the ``airflow `` user rather than
386
+ ``root ``. Attempts to install ``pip `` packages as ``root `` will fail with an appropriate error message.
387
+
388
+ .. exampleinclude :: docker-examples/extending/add-requirement-packages/Dockerfile
389
+ :language: Dockerfile
390
+ :start-after: [START Dockerfile]
391
+ :end-before: [END Dockerfile]
392
+
393
+
366
394
Example when writable directory is needed
367
395
.........................................
368
396
0 commit comments