如何使用在 GCP 中的 Container Registry 中使用
Running this docker run
local 进行私有映像工作正常:--privileged
docker run -it --privileged --entrypoint /bin/bash ${GKE_APP}
我跟着这个,但错误仍然存在。
这是我的 DAG:
def process_backup_data(data_to_backup):
secret_file = Secret('volume', '/etc/secrets', 'my-secret')
task_env_vars = {'GOOGLE_APPLICATION_CREDENTIALS': "/etc/secrets/my-sa.json}
security_context = {
'privileged': True,
'allow_privilege_escalation': True,
'capabilities': {'add': ['SYS_ADMIN']}
}
return KubernetesPodOperator(image="asia.gcr.io/my-image:latest",
env_vars=task_env_vars,
cmds=["sh", "run-vpn-script.sh"],
arguments=[data_to_backup],
labels={"project": "my-project"},
name="my-project-backup-datasets",
task_id=f"backup_{task_id}",
dag=dag,
secrets=[secret_file],
image_pull_policy='Always',
security_context=security_context # HERE
)