一个解决方法是在entrypoint.sh文件中手动创建用户。例如,将以下代码添加到entrypoint.sh文件中:
#!/usr/bin/env bash
useradd -ms /bin/bash myuser echo "myuser:password" | chpasswd
airflow "$@"
在Dockerfile中,设置entrypoint为entrypoint.sh文件:
COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
这样,在运行Docker容器时,entrypoint.sh脚本将被执行并创建一个名为“myuser”的用户,可以在其中运行Airflow。
请注意,这只是一个简单的示例,并且应该根据您的特定需求进行自定义。