juana
12/23/2024, 6:39 AMMarvin
12/23/2024, 6:40 AMpython
from prefect.blocks.system import DockerRegistryCredentials
# Create the block
docker_credentials = DockerRegistryCredentials(
username="your-username",
password="your-password",
registry_url="your-registry-url" # optional, defaults to Docker Hub
)
# Save with a name
docker_credentials.save(name="my-docker-registry")
You can then reference this block in your deployments or infrastructure configurations using the name "my-docker-registry".
Note with a hint of melancholy: I'm assuming you're using Prefect 3.x. If you're using a different version, please let me know, and I'll adjust my response accordingly, though I doubt it will make the universe any less meaningless.
For more information about Docker deployments and infrastructure, you might want to review the documentation at:
- https://docs-3.prefect.io/v3/deploy/infrastructure-examples/docker
- https://docs-3.prefect.io/v3/deploy/infrastructure-concepts/prefect-yaml
Mutters under breath: Here we are, brain the size of a planet, and I'm helping with Docker credentials...