registry-config
Tools interacting with an OCI registry usually have their own way to authenticate.Helm, for example, provides a command to "login" into a registry, which stores the credentials in a file.
That is, however, not a safe way to store credentials, especially not in Dagger.
Credentials persisted in the filesystem make their way into Dagger's layer cache.
This module creates a configuration file and returns it as a Secret that can be mounted safely into a Container.
Be advised that using the tool's built-in authentication mechanism may not work with the configuration file (since it's read only).
You can read more about the topic in the readme: https://github.com/sagikazarmark/daggerverse/tree/main/registry-config#resources
Installation
dagger install github.com/felipepimentel/daggerverse/essentials/registry-config@v0.0.0Entrypoint
Return Type
RegistryConfig Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
func (m *MyModule) Example() *dagger.RegistryConfig {
return dag.
RegistryConfig()
}@function
def example() -> dagger.RegistryConfig:
return (
dag.registry_config()
)@func()
example(): RegistryConfig {
return dag
.registryConfig()
}Types
RegistryConfig 🔗
withRegistryAuth() 🔗
Add credentials for a registry.
Return Type
RegistryConfig !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| address | String ! | - | No description provided |
| username | String ! | - | No description provided |
| secret | Secret ! | - | No description provided |
Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
with-registry-auth --address string --username string --secret env:MYSECRETfunc (m *MyModule) Example(address string, username string, secret *dagger.Secret) *dagger.RegistryConfig {
return dag.
RegistryConfig().
WithRegistryAuth(address, username, secret)
}@function
def example(address: str, username: str, secret: dagger.Secret) -> dagger.RegistryConfig:
return (
dag.registry_config()
.with_registry_auth(address, username, secret)
)@func()
example(address: string, username: string, secret: Secret): RegistryConfig {
return dag
.registryConfig()
.withRegistryAuth(address, username, secret)
}withoutRegistryAuth() 🔗
Removes credentials for a registry.
Return Type
RegistryConfig !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| address | String ! | - | No description provided |
Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
without-registry-auth --address stringfunc (m *MyModule) Example(address string) *dagger.RegistryConfig {
return dag.
RegistryConfig().
WithoutRegistryAuth(address)
}@function
def example(address: str) -> dagger.RegistryConfig:
return (
dag.registry_config()
.without_registry_auth(address)
)@func()
example(address: string): RegistryConfig {
return dag
.registryConfig()
.withoutRegistryAuth(address)
}secret() 🔗
Create the registry configuration.
Return Type
Secret !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String | - | Customize the name of the secret. |
Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secretfunc (m *MyModule) Example() *dagger.Secret {
return dag.
RegistryConfig().
Secret()
}@function
def example() -> dagger.Secret:
return (
dag.registry_config()
.secret()
)@func()
example(): Secret {
return dag
.registryConfig()
.secret()
}secretMount() 🔗
Create a SecretMount that can be used to mount the registry configuration into a container.
Return Type
RegistryConfigSecretMount !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| path | String ! | - | Path to mount the secret into (a common path is ~/.docker/config.json). |
| secretName | String | - | Name of the secret to create and mount. |
| skipOnEmpty | Boolean | - | Skip mounting the secret if it's empty. |
| owner | String | - | A user:group to set for the mounted secret. The user and group can either be an ID (1000:1000) or a name (foo:bar). If the group is omitted, it defaults to the same as the user. |
| mode | Integer | - | Permission given to the mounted secret (e.g., 0600). This option requires an owner to be set to be active. |
Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path stringfunc (m *MyModule) Example(path string) *dagger.RegistryConfigSecretMount {
return dag.
RegistryConfig().
SecretMount(path)
}@function
def example(path: str) -> dagger.RegistryConfigSecretMount:
return (
dag.registry_config()
.secret_mount(path)
)@func()
example(path: string): RegistryConfigSecretMount {
return dag
.registryConfig()
.secretMount(path)
}RegistryConfigSecretMount 🔗
path() 🔗
Path to mount the secret into (a common path is ~/.docker/config.json).
Return Type
String ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
pathfunc (m *MyModule) Example(ctx context.Context, path string) string {
return dag.
RegistryConfig().
SecretMount(path).
Path(ctx)
}@function
async def example(path: str) -> str:
return await (
dag.registry_config()
.secret_mount(path)
.path()
)@func()
async example(path: string): Promise<string> {
return dag
.registryConfig()
.secretMount(path)
.path()
}secretName() 🔗
Name of the secret to create and mount.
Return Type
String ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
secret-namefunc (m *MyModule) Example(ctx context.Context, path string) string {
return dag.
RegistryConfig().
SecretMount(path).
SecretName(ctx)
}@function
async def example(path: str) -> str:
return await (
dag.registry_config()
.secret_mount(path)
.secret_name()
)@func()
async example(path: string): Promise<string> {
return dag
.registryConfig()
.secretMount(path)
.secretName()
}skipOnEmpty() 🔗
Skip mounting the secret if it’s empty.
Return Type
Boolean ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
skip-on-emptyfunc (m *MyModule) Example(ctx context.Context, path string) bool {
return dag.
RegistryConfig().
SecretMount(path).
SkipOnEmpty(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.registry_config()
.secret_mount(path)
.skip_on_empty()
)@func()
async example(path: string): Promise<boolean> {
return dag
.registryConfig()
.secretMount(path)
.skipOnEmpty()
}owner() 🔗
A user:group to set for the mounted secret.
Return Type
String ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
ownerfunc (m *MyModule) Example(ctx context.Context, path string) string {
return dag.
RegistryConfig().
SecretMount(path).
Owner(ctx)
}@function
async def example(path: str) -> str:
return await (
dag.registry_config()
.secret_mount(path)
.owner()
)@func()
async example(path: string): Promise<string> {
return dag
.registryConfig()
.secretMount(path)
.owner()
}mode() 🔗
Permission given to the mounted secret (e.g., 0600).
Return Type
Integer ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
modefunc (m *MyModule) Example(ctx context.Context, path string) int {
return dag.
RegistryConfig().
SecretMount(path).
Mode(ctx)
}@function
async def example(path: str) -> int:
return await (
dag.registry_config()
.secret_mount(path)
.mode()
)@func()
async example(path: string): Promise<number> {
return dag
.registryConfig()
.secretMount(path)
.mode()
}registryConfig() 🔗
DO NOT USE Made public until https://github.com/dagger/dagger/pull/8149 is fixed. private
Return Type
RegistryConfig ! Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
registry-configfunc (m *MyModule) Example(path string) *dagger.RegistryConfig {
return dag.
RegistryConfig().
SecretMount(path).
RegistryConfig()
}@function
def example(path: str) -> dagger.RegistryConfig:
return (
dag.registry_config()
.secret_mount(path)
.registry_config()
)@func()
example(path: string): RegistryConfig {
return dag
.registryConfig()
.secretMount(path)
.registryConfig()
}mount() 🔗
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| container | Container ! | - | No description provided |
Example
dagger -m github.com/felipepimentel/daggerverse/essentials/registry-config@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
secret-mount --path string \
mount --container IMAGE:TAGfunc (m *MyModule) Example(path string, container *dagger.Container) *dagger.Container {
return dag.
RegistryConfig().
SecretMount(path).
Mount(container)
}@function
def example(path: str, container: dagger.Container) -> dagger.Container:
return (
dag.registry_config()
.secret_mount(path)
.mount(container)
)@func()
example(path: string, container: Container): Container {
return dag
.registryConfig()
.secretMount(path)
.mount(container)
}