-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail with error when extending image with pip run as root (#22292)
The production docker image installs airflow with --user flag for `airflow` user and all subsequent image extension should be done using `airflow` user. It is very easy however, to run `pip` as root user when you switched temporarily to the root user for `apt` installation. This PR makes the accidental `root` user run `pip` fail with error and redirection to the documentation where it is explained to the users that they should use `airflow` user for `pip` with examples. Fixes: #22250 GitOrigin-RevId: b00fc786723c4356de93792c32c85f62b2e36ed9
- Loading branch information
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
COLOR_RED=$'\e[31m' | ||
COLOR_RESET=$'\e[0m' | ||
COLOR_YELLOW=$'\e[33m' | ||
|
||
if [[ $(id -u) == "0" ]]; then | ||
echo | ||
echo "${COLOR_RED}You are running pip as root. Please use 'airflow' user to run pip!${COLOR_RESET}" | ||
echo | ||
echo "${COLOR_YELLOW}See: https://airflow.apache.org/docs/docker-stack/build.html#adding-a-new-pypi-package${COLOR_RESET}" | ||
echo | ||
exit 1 | ||
fi | ||
exec "${HOME}"/.local/bin/pip "${@}" |