【问题标题】:No git inside apache airflow docker containerapache airflow docker 容器内没有 git
【发布时间】:2023-01-04 22:25:16
【问题描述】:

我需要有关我最新气流中的git的帮助,我正在使用这张图片https://hub.docker.com/layers/apache/airflow/latest/images/sha256-3e0ab13f9525974867cbb612ff632d332b838b05fac4e59bf83f700827744d7d?context=explore并使用它运行一个容器,但是当我尝试执行下面的任务时,我收到了错误

当前 sn-ps

# Create a BashOperator to sync the Git repositories
git_sync_task = BashOperator(
    task_id='git_sync_task',
    bash_command='cd /opt/airflow/service1 && git pull origin main',
    dag=dag,
)

我收到这个错误,

[2023-01-04, 13:09:30 UTC] {subprocess.py:75} 信息 - 运行命令:['/bin/bash', '-c', 'cd /opt/***/service1 && git pull origin main'] [2023-01-04, 13:09:30 UTC] {subprocess.py:86} INFO - 输出: [2023-01-04, 13:09:30 UTC] {subprocess.py:93} INFO - /bin/bash: line 1: git: command not found [2023-01-04, 13:09:30 UTC] {subprocess.py:97} 信息 - 命令已退出,返回码为 127 [2023-01-04,13:09:30 UTC] {taskinstance.py:1772} 错误 - 任务因异常而失败

当我尝试在 airflow_airflow-webserver_1 容器中手动安装 git 时,我也遇到了与权限相关的错误,

default@3df7bafd3a37:/opt/airflow$ apt-get install git E: 无法 打开锁定文件 /var/lib/dpkg/lock-frontend - 打开(13:权限 denied) E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),你是 root 用户吗?

我该如何修复该 git 错误?

【问题讨论】:

    标签: git docker airflow


    【解决方案1】:

    打印(你好世界) 整数(输入)”

    【讨论】:

    • 你是什​​么意思?
    猜你喜欢
    • 2018-07-01
    • 2021-07-07
    • 2021-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-04
    • 2015-06-06
    • 1970-01-01
    相关资源
    最近更新 更多