swift-church-94876
07/04/2026, 9:05 AMancient-wolf-19325
07/04/2026, 9:05 AM# Create the secret (run in shell)
flyte create secret --type image_pull my-secret --from-file ~/.docker/config.json
# In Python
image = flyte.Image.from_debian_base(
name="my-image",
registry="registry.example.com/my-org",
registry_secret="my-secret"
)
env = flyte.TaskEnvironment(
name="my_task_env",
image=image,
secrets="my-secret"
)
According to Union.ai Docs, the secret name must match in both places, and the secret must be of type image_pull.
Would you like more detail on secret creation or usage?
Sources:
- Union.ai Docs: Container images - Remote ImageBuilder 👍 0 button 👎 0 button 💡 Hint: Mention @herald in the thread for followups.swift-church-94876
07/04/2026, 9:09 AMancient-wolf-19325
07/04/2026, 9:09 AMswift-church-94876
07/04/2026, 9:10 AMancient-wolf-19325
07/04/2026, 9:11 AMswift-church-94876
07/04/2026, 9:12 AMancient-wolf-19325
07/04/2026, 9:12 AMkubectl create secret docker-registry my-ghcr-secret \
--docker-server=ghcr.io \
--docker-username=<your-username> \
--docker-password=<your-personal-access-token> \
--docker-email=<your-email> \
-n <your-flyte-namespace>
2. Attach the secret to the service account used by Flyte tasks (default is usually default or flyte):
kubectl patch serviceaccount default \
-p '{"imagePullSecrets": [{"name": "my-ghcr-secret"}]}' \
-n <your-flyte-namespace>
3. Now, when Flyte launches a task, Kubernetes will use the imagePullSecret to pull from ghcr.io. No changes are needed in your Flyte SDK code for imagePullSecrets—just specify your private image as usual.
For more details and alternative methods (like custom pod templates), see the Flyte OSS private images guide.
Would you like an example for the custom pod template method as well?
Sources:
- Flyte OSS docs: Private images 👍 0 button 👎 0 button 💡 Hint: Mention @herald in the thread for followups.swift-church-94876
07/04/2026, 9:14 AMancient-wolf-19325
07/04/2026, 9:14 AMimport flyte
from kubernetes.client import V1Container, V1PodSpec, V1LocalObjectReference
# Create the pod template referencing your imagePullSecret
pod_template = flyte.PodTemplate(
primary_container_name="primary",
pod_spec=V1PodSpec(
containers=[V1Container(name="primary")],
image_pull_secrets=[V1LocalObjectReference(name="my-ghcr-secret")],
),
)
env = flyte.TaskEnvironment(
name="with_secret",
image="ghcr.io/your-org/your-image:tag",
pod_template=pod_template,
)
@env.task
async def my_task():
...
This ensures the pod running your task uses the specified imagePullSecret. For more, see the Flyte OSS pod templates guide.
Would you like more detail on customizing the pod template?
Sources:
- Flyte OSS docs: Pod templates 👍 1 button 👎 0 button 💡 Hint: Mention @herald in the thread for followups.