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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e
Entrypoint
Return Type
RegistryConfig
Example
dagger -m github.com/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
func (m *myModule) example() *RegistryConfig {
return dag.
RegistryConfig()
}
@function
def example() -> dag.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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
with-registry-auth --address string --username string --secret env:MYSECRET
func (m *myModule) example(address string, username string, secret *Secret) *RegistryConfig {
return dag.
RegistryConfig().
WithRegistryAuth(address, username, secret)
}
@function
def example(address: str, username: str, secret: dagger.Secret) -> dag.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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
without-registry-auth --address string
func (m *myModule) example(address string) *RegistryConfig {
return dag.
RegistryConfig().
WithoutRegistryAuth(address)
}
@function
def example(address: str) -> dag.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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret
func (m *myModule) example() *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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string
func (m *myModule) example(path string) *RegistryConfigSecretMount {
return dag.
RegistryConfig().
SecretMount(path)
}
@function
def example(path: str) -> dag.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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
path
func (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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
secret-name
func (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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
skip-on-empty
func (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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
owner
func (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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
mode
func (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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
registry-config
func (m *myModule) example(path string) *RegistryConfig {
return dag.
RegistryConfig().
SecretMount(path).
RegistryConfig()
}
@function
def example(path: str) -> dag.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/luanmtruong/daggerverse/registry-config@53ab4c8ea593685d0397a9e401ac85bfca0a960e call \
secret-mount --path string \
mount --container IMAGE:TAG
func (m *myModule) example(path string, container *Container) *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)
}